Search Results

Search found 784 results on 32 pages for 'da cheng'.

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

  • Deploy GWT Application to Google App Engine using NetBeans

    - by Yan Cheng CHEOK
    Hello, I try to deploy a GWT application, to Google App Engine using NetBeans. I had successful run GWT sample http://code.google.com/webtoolkit/doc/latest/tutorial/create.html using Personal GlassFish v3 Prelude Domain, by 1) Copy generated source code from StockWatcher to C:\Projects\StockWatcherNetbeans\src\java\com\google\ 2) Modify C:\Projects\StockWatcherNetbeans\nbproject\gwt.properties gwt.module=com.google.gwt.stockwatcher.StockWatcher 3) Select Personal GlassFish v3 Prelude Domain, and run. All works fine! Now, I try to select Google App Engine server, and run. However, I get the error "There is no appengine web project opened!" I check... There is file called C:\Projects\StockWatcherNetbeans\war\WEB-INF\appengine-web.xml with content <?xml version="1.0" encoding="UTF-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://kenai.com/projects/nbappengine/downloads/download/schema/appengine-web.xsd appengine-web.xsd'> <application>StockWatcherNetbeans</application> <version>1</version> </appengine-web-app> I am using NetBeans 6.7.1 GWT4NB (GWT Plugin for NetBeans) 2.6.12 Google App Engine plugin for NetBeans from http://kenai.com/downloads/nbappengine/1.0_NetBeans671/updates.xml Anything I had missed out? Even when I right click to the project, the Deploy to Google App Engine options is disabled. And yes, please do not ask me why not use Eclipse.

    Read the article

  • Does PHP session conflict with Share-Nothing-Architecture?

    - by Morgan Cheng
    When I first meet PHP, I'm amazed by the idea Sharing-Nothing-Architecture. I once in a project whose scalaiblity suffers from sharing data among different HTTP requests. However, as I proceed my PHP learning. I found that PHP has sessions. This looks conflict with the idea of sharing nothing. So, PHP session is just invented to make counterpart technology of ASP/ASP.NET/J2EE? Should high scalable web sites use PHP session?

    Read the article

  • Applet class loader cannot find one of the classes in the jar

    - by Chry Cheng
    I get the ff. error in Java Console occassionally: Exception in thread "thread applet-my.package.MyApplet-10" java.lang.NoClassDefFoundError: another/package/SomeClass at my.package.MyApplet.init(MyApplet.java:95) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: another.package.SomeClass at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 3 more Caused by: java.io.IOException: open HTTP connection failed:https://myserver/mycontext/applets/another/package/SomeClass.class at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 7 more My applet tag is as follows: <applet codebase="../../applets" code="my.package.MyApplet" class="invisible" id="myApplet"> <param value="value0" name="param0"/> ... <param value="valueN" name="paramN" /> <param value="folder/myApplet__0.0.1177.jar,folder/commons-io-1.3.2__0.0.1177.jar,..." name="cache_archive"/> <param value="0.0.1177.0,0.0.1177.0,...," name="cache_version"/> </applet> It is important I stress the word "occasionally". Sometimes the applet is initialized without a hitch. This also means that, often, when the browser is restarted, the problem goes away. I am aware of http://stackoverflow.com/questions/698890/applet-fails-to-load-class-from-jar and http://stackoverflow.com/questions/872905/applet-class-loader-cannot-find-a-class-in-the-applets-jar but I think they are not applicable to my case. SomeClass and MyApplet are in the same jar and the page is being accessed locally.

    Read the article

  • Subversion commit review software?

    - by Long Cheng
    Is there any existing software which can help enforce code review process like below: Dev user commit their changeset with proper comments, but the changeset does not goes into subversion repository directly, it will be pending in a "review software". Reviewer can see all pending changesets in the "review software", review the changeset and decide whether to allow the change into the code trunk. The dev user will receive notification either his changeset was accepted and merged into code trunk, or was rejected.

    Read the article

  • Should I make OR operator to return const reference or just reference

    - by Yan Cheng CHEOK
    class error_code { public: error_code() : hi(0), lo(0) {} error_code(__int64 lo) : hi(0), lo(lo) {} error_code(__int64 hi, __int64 lo) : hi(hi), lo(lo) {} error_code& operator|=(const error_code &e) { this->hi |= e.hi; this->lo |= e.lo; return *this; } __int64 hi; __int64 lo; }; error_code operator|(const error_code& e0, const error_code& e1) { return error_code(e0.hi | e1.hi, e0.lo | e1.lo); } int main() { error_code e0(1); error_code e1(2); e0 |= e1; } I was wondering, whether I should make operator|= to return a const error_code& or error_code& ?

    Read the article

  • Place JComponent On The Top Of JXLayer

    - by Yan Cheng CHEOK
    Hello, currently, I had successful applying JXLayer on my charting component, to draw a yellow information box on the top of it. final org.jdesktop.jxlayer.JXLayer<ChartPanel> layer = new org.jdesktop.jxlayer.JXLayer<ChartPanel>(this.chartPanel); this.chartLayerUI = new ChartLayerUI<ChartPanel>(this); layer.setUI(this.chartLayerUI); At the same time, I wish to add the following JComponent (DefaultDrawingView) on the top of JXLayer. This JComponent has the ability 1) To receive mouse event to draw figures on itself. Within ChartLayerUI, I add the following code @Override @SuppressWarnings("unchecked") public void installUI(JComponent c) { super.installUI(c); JXLayer<JComponent> l = (JXLayer<JComponent>) c; l.getGlassPane().setLayout(new java.awt.BorderLayout()); // this.view is DefaultDrawingView drawing object. l.getGlassPane().add(this.view, java.awt.BorderLayout.CENTER); } However, after having the above code, I get the following outcome 1) My charting component ChartPanel are being blocked by DefaultDrawingView 2) My charting component no longer able to receive mouse event. What I wish is that A) ChartPanel and DefaultDrawingView able to show up B) ChartPanel and DefaultDrawingView able to receive mouse event Is there other steps I had missed out, or did wrong? Thanks.

    Read the article

  • How does twitter server get to know single tweet ID from URL fragment segment?

    - by Morgan Cheng
    Each tweet has a single URL such as http://twitter.com/#!/DeliciousHot/status/23189589820702720. The tweet identification (/DeliciousHot/status/23189589820702720) is in the URL fragment segment which is not actually sent to server. Originally, I thought it works this way: The URL response doesn't have this tweet specific info. It is JavaScript module that extracts tweet id from current browser URL and fetch tweet payload with AJAX. The page content is then updated with the tweet payload. To my surprise, it is doesn't work this way! With Firebug, you can view that response of http://twitter.com/#!/DeliciousHot/status/23189589820702720 has tweet payload "10 Signs of a True Gentleman" text in inline JavaScript. The tweet payload is not fetched by another AJAX. So, how does Twitter server get to know the expected tweet ID even it is in URL fragment segment?

    Read the article

  • Will PHP Die In Web Page Development World?

    - by Morgan Cheng
    I know that PHP is still the most popular web programming language in the world. This question just want to bring some of my concerns about PHP. PHP is naturally bound to C10K problem. Since PHP (generally run in Apache) cannot be event-driven or asynchronous, each HTTP request will occupy at least one thread or process. This makes it resistant to be more scalable. Currently, a lot of web sites (like Facebook) with high performance and scalability still depends on PHP in their front end servers. I suppose it is due to legacy reason. Is it possible that PHP will be replaced by language more suitable for C10K?

    Read the article

  • How can I catch runtime error in C++

    - by Yan Cheng CHEOK
    By referring to http://stackoverflow.com/questions/315948/c-catching-all-exceptions try { int i = 0; int j = 0/i; /* Division by 0 */ int *k = 0; std::cout << *k << std::endl; /* De-reference invalid memory location. */ } catch (...) { std::cout << "Opps!" << std::endl; } The above run-time error are unable to be detected. Or, am I having wrong expectation on C++ exception handling feature?

    Read the article

  • Convert wchar_t to char

    - by Yan Cheng CHEOK
    I was wondering is it safe to do so? wchar_t wide = /* something */; assert(wide >= 0 && wide < 256 &&); char myChar = static_cast<char>(wide); If I am pretty sure the wide char will fall within ASCII range.

    Read the article

  • How to safely transfer reference to object across window?

    - by Morgan Cheng
    I'm debugging a web application. Javasript in one window create one object and use it as argument to invoke global method in another window. Pseudo code is like below. var obj = new Foo(); anotherWin.bar(obj); In anotherWin, the argument is stored in global variable. var g_obj; function bar(obj) { g_obj = obj; ... } When other function tries to reference g_obj.Id, it throws exception "Cannot evaluate expression". This happens in IE8.0.7600.16385 on Windows 7. In Visual Studio debugger, when this exception happens, the g_obj shows as {...} It looks all its properties are lost. Perhaps the root reason is the object is created in one window but only referenced in another window. The object might be garbage-collected at any time. Is there any way to work around this?

    Read the article

  • How to Treat Race Condition of Session in Web Application?

    - by Morgan Cheng
    I was in a ASP.NET application has heavy traffic of AJAX requests. Once a user login our web application, a session is created to store information of this user's state. Currently, our solution to keep session data consistent is quite simple and brutal: each request needs to acquire a exclusive lock before being processed. This works fine for tradition web application. But, when the web application turns to support AJAX, it turns to not efficient. It is quite possible that multiple AJAX requests are sent to server at the same time without reloading the web page. If all AJAX requests are serialized by the exclusive lock, the response is not so quick. Anyway, many AJAX requests that doesn't access same session variables are blocked as well. If we don't have a exclusive lock for each requests, then we need to treat all race condition carefully to avoid dead lock. I'm afraid that would make the code complex and buggy. So, is there any best practice to keep session data consistent and keep code simple and clean?

    Read the article

  • Problem in printing array of char pointer passing from Python

    - by Yan Cheng CHEOK
    My following C code works quite well, till my Python code trying to pass an array of char pointer to it. The output I obtain is The file_name is python-file Another 3 string is not being printed out. Anything I had missed out? C Code #include <iostream> #include "c_interface.h" int foo(const char* file_name, const char** names) { std::cout << "The file_name is " << file_name << std::endl; while (*names) { std::cout << "The name is " << *names << std::endl; names++; } return 0; } /* int main() { const char *c[] = {"123gh", "456443432", "789", 0}; foo("hello", c); getchar(); } */ Python Code #!c:/Python27/python.exe -u from ctypes import * name0 = "NAME0" name1 = "NAME1" name2 = "NAME2" names = ((c_char_p * 1024) * 4)() names[0].value = name0 names[1].value = name1 names[2].value = name2 names[3].value = 0 libc = CDLL("foo.dll") libc.foo("python-file", names)

    Read the article

  • How to use Caret to tell which line it is in from JTextPane? (Java)

    - by Alex Cheng
    Hi all. Problem: I have CaretListener and DocumentListener listening on a JTextPane. I need an algorithm that is able to tell which line is the caret at in a JTextPane, here's an illustrative example: Result: 3rd line Result: 2nd line Result: 4th line and if the algorithm can tell which line the caret is in the JTextPane, it should be fairly easy to substring whatever that is in between the parentheses as the picture (caret is at character m of metadata): -- This is how I divide the entire text that I retrieved from the JTextPane into sentences: String[] lines = textPane.getText().split("\r?\n|\r", -1); The sentences in the textPane is separated with \n. Problem is, how can I manipulate the caret to let me know at which position and which line it is in? I know the dot of the caret says at which position it is, but I can't tell which line it is at. Assuming if I know which line the caret is, then I can just do lines[<line number>] and manipulate the string from there. In Short: How do I use CaretListener and/or DocumentListener to know which line the caret is currently at, and retrieve the line for further string manipulation? Please help. Thanks. Do let me know if further clarification is needed. Thanks for your time.

    Read the article

  • Alert on gridview edit based on permission

    - by Vicky
    I have a gridview with edit option at the start of the row. Also I maintain a seperate table called Permission where I maintain user permissions. I have three different types of permissions like Admin, Leads, Programmers. These all three will have access to the gridview. Except admin if anyone tries to edit the gridview on clicking the edit option, I need to give an alert like This row has important validation and make sure you make proper changes. When I edit, the action with happen on table called Application. The table has a column called Comments. Also the alert should happen only when they try to edit rows where the Comments column have these values in them. ManLog datas Funding Approved Exported Applications My try so far. public bool IsApplicationUser(string userName) { return CheckUser(userName); } public static bool CheckUser(string userName) { string CS = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); DataTable dt = new DataTable(); using (SqlConnection connection = new SqlConnection(CS)) { SqlCommand command = new SqlCommand(); command.Connection = connection; string strquery = "select * from Permissions where AppCode='Nest' and UserID = '" + userName + "'"; SqlCommand cmd = new SqlCommand(strquery, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); } if (dt.Rows.Count >= 1) return true; else return true; } protected void Details_RowCommand(object sender, GridViewCommandEventArgs e) { string currentUser = HttpContext.Current.Request.LogonUserIdentity.Name; string str = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); string[] words = currentUser.Split('\\'); currentUser = words[1]; bool appuser = IsApplicationUser(currentUser); if (appuser) { DataSet ds = new DataSet(); using (SqlConnection connection = new SqlConnection(str)) { SqlCommand command = new SqlCommand(); command.Connection = connection; string strquery = "select Role_Cd from User_Role where AppCode='PM' and UserID = '" + currentUser + "'"; SqlCommand cmd = new SqlCommand(strquery, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); } if (e.CommandName.Equals("Edit") && ds.Tables[0].Rows[0]["Role_Cd"].ToString().Trim() != "ADMIN") { int index = Convert.ToInt32(e.CommandArgument); GridView gvCurrentGrid = (GridView)sender; GridViewRow row = gvCurrentGrid.Rows[index]; string strID = ((Label)row.FindControl("lblID")).Text; string strAppName = ((Label)row.FindControl("lblAppName")).Text; Response.Redirect("AddApplication.aspx?ID=" + strID + "&AppName=" + strAppName + "&Edit=True"); } } } Kindly let me know if I need to add something. Thanks for any suggestions.

    Read the article

  • Must a Language that Implements Monads be Statically Typed?

    - by Morgan Cheng
    I am learning functional programming style. From this link http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/, Brian Beckman gave a brilliant introduction about Monad. He mentioned that Monad is about composition of functions so as to address complexity. A Monad includes a unit function that transfers type T to an amplified type M(T); and a Bind function that, given function from T to M(U), transforms type M(T) to another type M(U). (U can be T, but is not necessarily). In my understanding, the language implementing monad should be type-checked statically. Otherwise, type errors cannot be found during compilation and "Complexity" is not controlled. Is my understanding correct?

    Read the article

  • AtomicInteger lazySet and set

    - by Yan Cheng CHEOK
    May I know what is the difference among lazySet and set method for AtomicInteger. javadoc doesn't talk much about lazySet : Eventually sets to the given value. It seems that AtomicInteger will not immediately be set to the desired value, but it will be scheduled to be set in some time. But, what is the practical use of this method? Any example?

    Read the article

  • Is it possible to listen to relational database update?

    - by Morgan Cheng
    Is it possible to listen to relation database update? For example, my web app want to send data update to client through Comet technology. I can have the program to poll the database periodically, but that would not be performant and scalable. If app can hood to a "event handler" of database, then app can get notification every time given database table data is updated. This sounds more promising, but I didn't find any concrete example for it. This is listener pattern. Does common relational database support such feature?

    Read the article

  • Access Violation When Accessing an STL Object Through A Pointer or Reference In A Different DLL or E

    - by Yan Cheng CHEOK
    I experience the following problem while using legacy VC6. I just cann't switch to modern compiler, as I am working on a legacy code base. http://support.microsoft.com/kb/172396 Since there are no way to export map, my planned workaround is using static linking instead of dynamic linking. I was wondering whether you all had encountered the similar situation? What is your workaround for this? Another workaround is to create wrapper class around the stl map, to ensure creation and accessing stl map, are within the same DLL space. Note that, fun0, which uses wrapper class will just work fine. fun1 will crash. Here is the code example : // main.cpp. Compiled it as exe. #pragma warning (disable : 4786) #include <map> #include <string> template <class K, class V> class __declspec(dllimport) map_wrapper { public: map_wrapper(); ~map_wrapper(); map_wrapper(const map_wrapper&); map_wrapper& operator=(const map_wrapper&); V& operator[](const K&); const V& operator[](const K&) const; const V& get(const K&) const; void put(const K&, const V&); int size() const; private: std::map<K, V> *m; }; __declspec(dllimport) void fun0(map_wrapper<std::string, int>& m); __declspec(dllimport) void fun1(std::map<std::string, int>& m); int main () { map_wrapper<std::string, int> m0; std::map<std::string, int> m1; m0["hello"] = 888; m1["hello"] = 888; // Safe. The we create std::map and access map both in dll space. fun0(m0); // Crash! The we create std::map in exe space, and access map in dll space. fun1(m1); return 0; } // dll.cpp. Compiled it as dynamic dll. #pragma warning (disable : 4786) #include <map> #include <string> #include <iostream> /* In map_wrapper.h */ template <class K, class V> class __declspec(dllexport) map_wrapper { public: map_wrapper(); ~map_wrapper(); map_wrapper(const map_wrapper&); map_wrapper& operator=(const map_wrapper&); V& operator[](const K&); const V& operator[](const K&) const; const V& get(const K&) const; void put(const K&, const V&); int size() const; private: std::map<K, V> *m; }; /* End */ /* In map_wrapper.cpp */ template <class K, class V> map_wrapper<K, V>::map_wrapper() : m(new std::map<K, V>()) { } template <class K, class V> map_wrapper<K, V>::~map_wrapper() { delete m; } template <class K, class V> map_wrapper<K, V>::map_wrapper(const map_wrapper<K, V>& map) : m(new std::map<K, V>(*(map.m))) { } template <class K, class V> map_wrapper<K, V>& map_wrapper<K, V>::operator=(const map_wrapper<K, V>& map) { std::map<K, V>* tmp = this->m; this->m = new std::map<K, V>(*(map.m)); delete tmp; return *this; } template <class K, class V> V& map_wrapper<K, V>::operator[](const K& key) { return (*this->m)[key]; } template <class K, class V> const V& map_wrapper<K, V>::operator[](const K& key) const { return (*this->m)[key]; } template <class K, class V> const V& map_wrapper<K, V>::get(const K& key) const { return (*this->m)[key]; } template <class K, class V> void map_wrapper<K, V>::put(const K& key, const V& value) { (*this->m)[key] = value; } template <class K, class V> int map_wrapper<K, V>::size() const { return this->m->size(); } // See : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.15 // [35.15] How can I avoid linker errors with my template classes? template class __declspec(dllexport) map_wrapper<std::string, int>; /* End */ __declspec(dllexport) void fun0(map_wrapper<std::string, int>& m) { std::cout << m["hello"] << std::endl; } __declspec(dllexport) void fun1(std::map<std::string, int>& m) { std::cout << m["hello"] << std::endl; }

    Read the article

  • Implementing coroutines in Java

    - by JUST MY correct OPINION
    This question is related to my question on existing coroutine implementations in Java. If, as I suspect, it turns out that there is no full implementation of coroutines currently available in Java, what would be required to implement them? As I said in that question, I know about the following: You can implement "coroutines" as threads/thread pools behind the scenes. You can do tricksy things with JVM bytecode behind the scenes to make coroutines possible. The so-called "Da Vinci Machine" JVM implementation has primitives that make coroutines doable without bytecode manipulation. There are various JNI-based approaches to coroutines also possible. I'll address each one's deficiencies in turn. Thread-based coroutines This "solution" is pathological. The whole point of coroutines is to avoid the overhead of threading, locking, kernel scheduling, etc. Coroutines are supposed to be light and fast and to execute only in user space. Implementing them in terms of full-tilt threads with tight restrictions gets rid of all the advantages. JVM bytecode manipulation This solution is more practical, albeit a bit difficult to pull off. This is roughly the same as jumping down into assembly language for coroutine libraries in C (which is how many of them work) with the advantage that you have only one architecture to worry about and get right. It also ties you down to only running your code on fully-compliant JVM stacks (which means, for example, no Android) unless you can find a way to do the same thing on the non-compliant stack. If you do find a way to do this, however, you have now doubled your system complexity and testing needs. The Da Vinci Machine The Da Vinci Machine is cool for experimentation, but since it is not a standard JVM its features aren't going to be available everywhere. Indeed I suspect most production environments would specifically forbid the use of the Da Vinci Machine. Thus I could use this to make cool experiments but not for any code I expect to release to the real world. This also has the added problem similar to the JVM bytecode manipulation solution above: won't work on alternative stacks (like Android's). JNI implementation This solution renders the point of doing this in Java at all moot. Each combination of CPU and operating system requires independent testing and each is a point of potentially frustrating subtle failure. Alternatively, of course, I could tie myself down to one platform entirely but this, too, makes the point of doing things in Java entirely moot. So... Is there any way to implement coroutines in Java without using one of these four techniques? Or will I be forced to use the one of those four that smells the least (JVM manipulation) instead?

    Read the article

  • Usage of VIsual Memory Leak Detector

    - by Yan Cheng CHEOK
    I found a very interesting memory leak detector by using Visual C++. http://www.codeproject.com/KB/applications/visualleakdetector.aspx I try it out, but cannot make it works to detect a memory leak code. I am using MS Visual Studio 2008. Any step I had missed out? #include "stdafx.h" #include "vld.h" #include <iostream> void fun() { new int[1000]; } int _tmain(int argc, _TCHAR* argv[]) { fun(); std::cout << "lead?" << std::endl; getchar(); return 0; } The output when I run in debug mode is : ... ... 'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\msvcr80.dll', Symbols loaded. 'Test.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded (source information stripped). 'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll', Symbols loaded. 'Test.exe': Loaded 'C:\Program Files\Visual Leak Detector\bin\dbghelp.dll', Symbols loaded (source information stripped). Visual Leak Detector Version 1.9d installed. No memory leaks detected. Visual Leak Detector is now exiting. The program '[5468] Test.exe: Native' has exited with code 0 (0x0).

    Read the article

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