Search Results

Search found 180 results on 8 pages for 'eugene lim'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • mod rewrite escape chars

    - by Eugene
    hi, simple question www.site.com/page/3 to be www.site.com/page--3 so that i can read the pagenumber and page This is what i got but i dont know how to use the '--' and slash together instead. RewriteRule ^/?([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?page=$1&subpage=$2 Any help appreciated

    Read the article

  • Is perl's each function worth using?

    - by eugene y
    From perldoc -f each we read: There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. The iterator is not reset when you leave the scope containing the each(), and this can lead to bugs: my %h = map { $_, 1 } qw(1 2 3); while (my $k = each %h) { print "1: $k\n"; last } while (my $k = each %h) { print "2: $k\n" } Output: 1: 1 2: 3 2: 2 What are the common workarounds for this behavior? And is it worth using each in general?

    Read the article

  • Is perl's each function worth using?

    - by eugene y
    From perldoc -f each we read: There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. The iterator is not reset when you leave the scope containing the each(), and this can lead to bugs: my %h = map { $_, 1 } qw(1 2 3); while (my $k = each %h) { print "1: $k\n"; last } while (my $k = each %h) { print "2: $k\n" } Output: 1: 1 2: 3 2: 2 What are the common workarounds for this behavior? And is it worth using each in general?

    Read the article

  • How does MySQL's ORDER BY RAND() work?

    - by Eugene
    Hi, I've been doing some research and testing on how to do fast random selection in MySQL. In the process I've faced some unexpected results and now I am not fully sure I know how ORDER BY RAND() really works. I always thought that when you do ORDER BY RAND() on the table, MySQL adds a new column to the table which is filled with random values, then it sorts data by that column and then e.g. you take the above value which got there randomly. I've done lots of googling and testing and finally found that the query Jay offers in his blog is indeed the fastest solution: SELECT * FROM Table T JOIN (SELECT CEIL(MAX(ID)*RAND()) AS ID FROM Table) AS x ON T.ID >= x.ID LIMIT 1; While common ORDER BY RAND() takes 30-40 seconds on my test table, his query does the work in 0.1 seconds. He explains how this functions in the blog so I'll just skip this and finally move to the odd thing. My table is a common table with a PRIMARY KEY id and other non-indexed stuff like username, age, etc. Here's the thing I am struggling to explain SELECT * FROM table ORDER BY RAND() LIMIT 1; /*30-40 seconds*/ SELECT id FROM table ORDER BY RAND() LIMIT 1; /*0.25 seconds*/ SELECT id, username FROM table ORDER BY RAND() LIMIT 1; /*90 seconds*/ I was sort of expecting to see approximately the same time for all three queries since I am always sorting on a single column. But for some reason this didn't happen. Please let me know if you any ideas about this. I have a project where I need to do fast ORDER BY RAND() and personally I would prefer to use SELECT id FROM table ORDER BY RAND() LIMIT 1; SELECT * FROM table WHERE id=ID_FROM_PREVIOUS_QUERY LIMIT 1; which, yes, is slower than Jay's method, however it is smaller and easier to understand. My queries are rather big ones with several JOINs and with WHERE clause and while Jay's method still works, the query grows really big and complex because I need to use all the JOINs and WHERE in the JOINed (called x in his query) sub request. Thanks for your time!

    Read the article

  • SQL2k8 T-SQL: Output into XML file

    - by Nai
    I have two tables Table Name: Graph UID1 UID2 ----------- 12 23 12 32 41 51 32 41 Table Name: Profiles NodeID UID Name ----------------- 1 12 Robs 2 23 Jones 3 32 Lim 4 41 Teo 5 51 Zacks I want to get an xml file like this: <graph directed="0"> <node id="1"> <att name="UID" value="12"/> <att name="Name" value="Robs"/> </node> <node id="2"> <att name="UID" value="23"/> <att name="Name" value="Jones"/> </node> <node id="3"> <att name="UID" value="32"/> <att name="Name" value="Lim"/> </node> <node id="4"> <att name="UID" value="41"/> <att name="Name" value="Teo"/> </node> <node id="5"> <att name="UID" value="51"/> <att name="Name" value="Zacks"/> </node> <edge source="12" target="23" /> <edge source="12" target="32" /> <edge source="41" target="51" /> <edge source="32" target="41" /> </graph> Thanks very much!

    Read the article

  • JPA getSingleResult() or null

    - by Eugene Ramirez
    Hi. I have an insertOrUpdate method which inserts an Entity when it doesn't exist or update it if it does. To enable this, I have to findByIdAndForeignKey, if it returned null insert if not then update. The problem is how do I check if it exists? So I tried getSingleResult. But it throws an exception if the public Profile findByUserNameAndPropertyName(String userName, String propertyName) { String namedQuery = Profile.class.getSimpleName() + ".findByUserNameAndPropertyName"; Query query = entityManager.createNamedQuery(namedQuery); query.setParameter("name", userName); query.setParameter("propName", propertyName); Object result = query.getSingleResult(); if(result==null)return null; return (Profile)result; } but "getSingleResult" throws an exception. Thanks

    Read the article

  • Simple Android OpenGL App Lag

    - by Eugene
    Hi, I have an Android OpenGL application which simply draws 2D squares (using 2 triangles) and animates them moving down the screen. I essentially do this by running: glLoadIdentity(), then glTranslatef, and finally glDrawElements all in a for loop. (The for loop is to draw all 10 blocks on the screen for every frame). In every drawFrame, the y-position of the blocks increments for the animation. The problem I'm having is strange. I run the application and the animation is laggy and not smooth. Then I re-run the application and I get a smooth animation. If I run again, I may get a smooth animation, or possibly not. Is my method correct, or is there a better way of doing this animation? Thanks for the help!

    Read the article

  • Why is this exception thrown in the visual studio C compiler?

    - by Shane Larson
    Hello. I am trying to get more adept and my C programming and I was attempting to test out displaying a character from the input stream while inside of the loop that is getting the character. I am using the getchar() method. I am getting an exception thrown at the time that the printf statement in my code is present. (If I comment out the printf line in this function, the exception is not thrown). Exception: Unhandled exception at 0x611c91ad (msvcr90d.dll) in firstOS.exe: 0xC0000005: Access violation reading location 0x00002573. Here is the code... Any thoughts? Thank you. PS. I am using the stdio.h library. /*getCommandPromptNew - obtains a string command prompt.*/ void getCommandPromptNew(char s[], int lim){ int i, c; for(i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i){ s[i] = c; printf('%s', c); } }

    Read the article

  • How can I apply a style to existing tikz node on specific slides

    - by Eugene Pimenov
    This is what I'm trying to do \begin{tikzpicture} [node distance = 1cm, auto,font=\footnotesize, % STYLES every node/.style={node distance=1.3cm}, comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm, font=}, module/.style={rectangle, drop shadow, draw, fill=black!10, inner sep=5pt, text width=3cm, text badly centered, minimum height=0.8cm, font=\bfseries\footnotesize\sffamily,rounded corners}, selected/.style={fill=red!40}] \node [module] (nodeA) {node A}; \node [module, below of=nodeA] (nodeA) {node B}; \only<1>{ \node [comment, text width=6cm, right=0.25 of nodeA] {short description of Node A}; \node [comment, text width=6cm, right=0.25 of nodeB] {short description of Node B}; } \only<2>{ \node [selected] (nodeA) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node A}; } \only<3>{ \node [selected] (nodeB) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node B}; } \end{tikzpicture} The problem is \node [selected] (nodeB) {}; creates a new node, but I want it to apply the style for the existing node. Is there any way to do so? Of course I could have copies of every node in selected state and not-selected state, but I really want to have a normal solution.

    Read the article

  • Web application vs. linux multiuser application

    - by Eugene
    I have a web-based bussines application written in C#/ASP.NET Recently my boss start pushing to re-write the app as Linux multi-user desktop application. In his design users will need to connect to Linux server via VNC or alike to use the app. I am not familiar with this kind of application design. I'd appretiate any help explainig pros and cons of this approach vs. web and perhaps vs. traditional client-server design Thank you

    Read the article

  • Installing a python wrapper for a c++ library

    - by Eugene Kogan
    Hi all, I am trying to install the python wrapper for the ANN (approx near neighbors) c++ library: link is http://www.scipy.org/scipy/scikits/wiki/AnnWrapper . I am on Windows 7 32-bit. Unfortunately the documentation is a bit terse and I am a newbie to programming in general, so I cannot decipher the instructions found within. I have not built a C++ library before and am not even sure how to get that far. Can anyone please guide? Thanks! gene

    Read the article

  • Client-side validation breaks in IE because of PropertyProxyValidator and ScriptManager cooperation.

    - by Eugene
    The specific of the project is in using Enterpise Library for Server side validation and jQuery for client-side validation. So I have the next simple form for example: <asp:Content ID="_mainContent" ContentPlaceHolderID="MainContent" runat="server"> <script src="../../../Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="../../../Scripts/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#aspnetForm").validate({ rules: { "<%= _txtProjectName.UniqueID %>": { required: true } } }); }); </script> <asp:TextBox ID="_txtProjectName" runat="server" CssClass="textBoxWithValidator_long" /> <entlib:PropertyProxyValidator id="_validatorProjectName" runat="server" ControlToValidate="_txtProjectName" PropertyName="ProjectName" SourceTypeName="LabManagement.Project.Project" /> <asp:Button CssClass="cell_InlineElement" ID="_btnSave" runat="server" Text="Save" onclick="_btnSave_Click" Width="50px" /> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"> </asp:ScriptManager> </asp:Content> The problem is in the next: client-side validation worked correctly before I needed to implement some AJAX.NET feature. So I have to add to the page ScriptManager (the last two lines in the code). But after that the next situation appeared: In InternetExplorer((7) - only in IE !!! - in Firefox everything works correctly) after clicking save button, if left the textbox ProjectName empty the client-side jquery validation appears but (!) the page submits to the server anyway. Some notes: If delete PropertyProxyValidator from the page - the client-side validation works correctly in IE but I need it for specific of the project. It seems that the problem is in the function WebForm_OnSubmit() that is inserted to the form after PropertyProxyValidator adding. ( ... <form name="aspnetForm" method="post" action="Project.aspx?TransType=NewProject" onsubmit="javascript:return WebForm_OnSubmit();" ...>) Could anyone help, please.

    Read the article

  • How to install Multiple ActiveX Controls per one step?

    - by Eugene
    My .ocx contains two ActiveX controls and I use both of them on one page. When user comes to page he gets two install confirmations for the same binary. After the first installation and page reload he gets one control displayed and “the website wants to run the following add-on...” yellow bar with control’s run confirmation for the other. I have only two possible solutions: Adding my CLSID’s to IE’s pre-approved control list, but I guess I cannot do it in the case of Non-Admin installation. Besides I consider this way as unreliable. Use the third control-container for hosting all other controls. It seems to my too complicated. Actually I’m not sure it can be done. Controls are used from the WEB, so I cannot use any administrative tools for installation. Is it possible to do all installation actions with one step without twice installation or run confirmation? Are there any “Best practices” for my case?

    Read the article

  • What's the proper way to fork() in FastCGI ?

    - by eugene y
    I have an app running under Catalyst+FastCGI. And I want it to fork() to do some work in background. I used this code for plain CGI long ago: defined(my $pid = fork) or die "Can't fork: $!"; if ($pid) { # print response exit 0; } die "Can't start a new session: $!" if setsid == -1; close STDIN or die $!; close STDOUT or die $!; close STDERR or die $!; # do some work in background I tried some variations on this under FastCGI but with no success. How should forking be done under FastCGI?

    Read the article

  • lexer skips a token

    - by Eugene Strizhok
    I am trying to do basic ANTLR-based scanning. I have a problem with a lexer not matching wanted tokens. lexer grammar DefaultLexer; ALPHANUM : (LETTER | DIGIT)+; ACRONYM : LETTER '.' (LETTER '.')+; HOST : ALPHANUM (('.' | '-') ALPHANUM)+; fragment LETTER : UNICODE_CLASS_LL | UNICODE_CLASS_LM | UNICODE_CLASS_LO | UNICODE_CLASS_LT | UNICODE_CLASS_LU; fragment DIGIT : UNICODE_CLASS_ND | UNICODE_CLASS_NL; For the grammar above, hello. world string given as an input results in world only. Whereas I would expect to get both hello and world. What am I missing? Thanks.

    Read the article

  • [Flex] Caching canvas into ByteArray

    - by Eugene
    Task: (all in code, not visual) create a canvas, place into it some labels and draw some lines, then cache it as byteArray. The problem is that if I cache an object that is already drawed on the screen, it works great, but if I cache a canvas, that have been created few lines earlier, this results white image. Is there any solution to cache a display object, that was created in code, but not intended to be displayed at all?

    Read the article

  • Starting work with SVN and basic folder structure.

    - by Eugene
    I have read little about TortoiseSVN and it capabilities, but I just can't understand how should I use basic structure. /trunk /branches /tags I have created FSFS type repo and I have imported basic structure. NB! No checkouts yet. I also have my project files in another place. How should I continue my work from here? Should I checkout repository-place all files in trunk folder-add them-commit them-then create tag for current trunk state-create branche for my goal I'm tring to achive-switch to created branch and work there? By the way my repo is local and whole work too. I thank everyone for help.

    Read the article

  • How do I change the JAVA_HOME for ant?

    - by Eugene M
    I'm doing java work on a class server where I don't have root. Whenever I try to compile using ant, it points to the wrong directory (/usr/tomcat instead of /usr/tomcat/jre ). One of the things we were told to do when setting up our user accounts was to add export JAVA_HOME=/usr/tomcat/jre to the .bashrc file. I don't know if that was supposed to take care of the problem but it doesn't seem to. So, how can I change the JAVA_HOME property for ant but only for when I run ant? EDIT: echo $JAVA_HOME points to /usr/tomcat/jre echo $JAVA_HOME\bin points to /usr/tomcat/jrebin The problem is when I normally run ant I get this error: Unable to locate tools.jar. Expected to find it in /usr/tomcat/lib/tools.jar Buildfile: build.xml compile: [javac] Compiling 1 source file to /home/ejm244/build/classes BUILD FAILED /home/ejm244/build.xml:9: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK Total time: 0 seconds

    Read the article

  • Chrome extension sendRequest from async callback not working?

    - by Eugene
    Can't figure out what's wrong. onRequest not triggered on call from async callback method, the same request from content script works. The sample code below. background.js ============= ... makeAsyncRequest(); ... chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { switch (request.id) { case "from_content_script": // This works console.log("from_content_script"); sendResponse({}); // clean up break; case "from_async": // Not working! console.log("from_async"); sendResponse({}); // clean up break; } }); methods.js ========== makeAsyncRequest = function() { ... var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { ... // It works console.log("makeAsyncRequest callback"); chrome.extension.sendRequest({id: "from_async"}, function(response) { }); } } ... }; UPDATE: manifest configuration file. Don't no what's wrong here. { "name": "TestExt", "version": "0.0.1", "icons": { "48": "img/icon-48-green.gif" }, "description": "write it later", "background_page": "background.html", "options_page": "options.html", "browser_action": { "default_title": "TestExt", "default_icon": "img/icon-48-green.gif" }, "permissions": [ "tabs", "http://*/*", "https://*/*", "file://*/*", "webNavigation" ] }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >