Search Results

Search found 251 results on 11 pages for 'lucas leitao'.

Page 6/11 | < Previous Page | 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • Poor LLVM JIT performance

    - by Paul J. Lucas
    I have a legacy C++ application that constructs a tree of C++ objects. I want to use LLVM to call class constructors to create said tree. The generated LLVM code is fairly straight-forward and looks repeated sequences of: ; ... %11 = getelementptr [11 x i8*]* %Value_array1, i64 0, i64 1 %12 = call i8* @T_string_M_new_A_2Pv(i8* %heap, i8* getelementptr inbounds ([10 x i8]* @0, i64 0, i64 0)) %13 = call i8* @T_QueryLoc_M_new_A_2Pv4i(i8* %heap, i8* %12, i32 1, i32 1, i32 4, i32 5) %14 = call i8* @T_GlobalEnvironment_M_getItemFactory_A_Pv(i8* %heap) %15 = call i8* @T_xs_integer_M_new_A_Pvl(i8* %heap, i64 2) %16 = call i8* @T_ItemFactory_M_createInteger_A_3Pv(i8* %heap, i8* %14, i8* %15) %17 = call i8* @T_SingletonIterator_M_new_A_4Pv(i8* %heap, i8* %2, i8* %13, i8* %16) store i8* %17, i8** %11, align 8 ; ... Where each T_ function is a C "thunk" that calls some C++ constructor, e.g.: void* T_string_M_new_A_2Pv( void *v_value ) { string *const value = static_cast<string*>( v_value ); return new string( value ); } The thunks are necessary, of course, because LLVM knows nothing about C++. The T_ functions are added to the ExecutionEngine in use via ExecutionEngine::addGlobalMapping(). When this code is JIT'd, the performance of the JIT'ing itself is very poor. I've generated a call-graph using kcachegrind. I don't understand all the numbers (and this PDF seems not to include commas where it should), but if you look at the left fork, the bottom two ovals, Schedule... is called 16K times and setHeightToAtLeas... is called 37K times. On the right fork, RAGreed... is called 35K times. Those are far too many calls to anything for what's mostly a simple sequence of call LLVM instructions. Something seems horribly wrong. Any ideas on how to improve the performance of the JIT'ing?

    Read the article

  • File-level filesystem change notification in Mac OS X

    - by Paul J. Lucas
    I want my code to be notified when any file under (either directly or indirectly) a given directory is modified. By "modified", I mead I want my code to be notified whenever a file's contents are altered, it's renamed, or it's deleted; or if a new file is added. For my application, there can be thousands of files. I looked as FSEvents, but its Technology Overview says, in part: The important point to take away is that the granularity of notifications is at a directory level. It tells you only that something in the directory has changed, but does not tell you what changed. It also says: The file system events API is also not designed for finding out when a particular file changes. For such purposes, the kqueues mechanism is more appropriate. However, in order to use kqueue on a given file, one has to open the file to obtain a file descriptor. It's impractical to manage thousands of file descriptors (and would probably exceed the maximum allowable number of open file descriptors anyway). Curiously, under Windows, I can use the ReadDirectoryChangesW() function and it does precisely what I want. So how can one do what I want under Mac OS X? Or, asked another way: how would one go about writing the equivalent of ReadDirectoryChangesW() for Mac OS X in user-space (and do so very efficiently)?

    Read the article

  • Testing install procedure of a program requiring administrative privileges

    - by Lucas Meijer
    I'm trying to write automated test, to ensure that the installer for my program works okay. The program can be installed for all users (requires admin privs), or for current user (does not require admin privs). The program can also autoupdate itself, which in some cases requires admin privileges, and in some cases doesn't. I'm looking for a way where I can have an automated test click "Yes, Allow" on the UAC dialogs, so I can write tests for all different scenarios, on many different operating systems, so that I can be confident when I make changes to the installer that I didn't break anything. Obviously, the installer process itself cannot do this. However, I control the complete machine, and could easily start some sort of daemon process with administrative rights, that the testprogram could make a socket connection to, to request it to "please click ok on the UAC now".

    Read the article

  • How to have struct members accessible in different ways

    - by Paul J. Lucas
    I want to have a structure token that has start/end pairs for position, sentence, and paragraph information. I also want the members to be accessible in two different ways: as a start/end pair and individually. Given: struct token { struct start_end { int start; int end; }; start_end pos; start_end sent; start_end para; typedef start_end token::*start_end_ptr; }; I can write a function, say distance(), that computes the distance between any of the three start/end pairs like: int distance( token const &i, token const &j, token::start_end_ptr mbr ) { return (j.*mbr).start - (i.*mbr).end; } and call it like: token i, j; int d = distance( i, j, &token::pos ); that will return the distance of the pos pair. But I can also pass &token::sent or &token::para and it does what I want. Hence, the function is flexible. However, now I also want to write a function, say max(), that computes the maximum value of all the pos.start or all the pos.end or all the sent.start, etc. If I add: typedef int token::start_end::*int_ptr; I can write the function like: int max( list<token> const &l, token::int_ptr p ) { int m = numeric_limits<int>::min(); for ( list<token>::const_iterator i = l.begin(); i != l.end(); ++i ) { int n = (*i).pos.*p; // NOT WHAT I WANT: It hard-codes 'pos' if ( n > m ) m = n; } return m; } and call it like: list<token> l; l.push_back( i ); l.push_back( j ); int m = max( l, &token::start_end::start ); However, as indicated in the comment above, I do not want to hard-code pos. I want the flexibility of accessible the start or end of any of pos, sent, or para that will be passed as a parameter to max(). I've tried several things to get this to work (tried using unions, anonymous unions, etc.) but I can't come up with a data structure that allows the flexibility both ways while having each value stored only once. Any ideas how to organize the token struct so I can have what I want? Attempt at clarification Given struct of pairs of integers, I want to be able to "slice" the data in two distinct ways: By passing a pointer-to-member of a particular start/end pair so that the called function operates on any pair without knowing which pair. The caller decides which pair. By passing a pointer-to-member of a particular int (i.e., only one int of any pair) so that the called function operates on any int without knowing either which int or which pair said int is from. The caller decides which int of which pair. Another example for the latter would be to sum, say, all para.end or all sent.start. Also, and importantly: for #2 above, I'd ideally like to pass only a single pointer-to-member to reduce the burden on the caller. Hence, me trying to figure something out using unions.

    Read the article

  • How to differentiate document requests from variable requests? and how to allow for urls that are no

    - by Lucas
    Hello. My last post was met by smarmy, unhelpful "answers" (comments), so i'll get right to it: if I have an htaccess file like so: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] RewriteRule ^([^/]+)/([^/]+)$ /index.php?page=$1&subject=$2 RewriteRule ^([^/]+)$ /index.php?page=$1 [L] how can I allow for other url variable names and values to be handled... say for instance I want to add extra unexpected url vars to this scenario /page/subject?urlvar1=value1&urlvar2=value2 and get the page I want without creating unexpected results? Any real help is greatly appreciated. Thanks!

    Read the article

  • CouchDB, HDFS, HBase or which is right for my situation?

    - by Lucas
    Hello all, This question is regarding data storage systems such as CouchDB, HDFS and HBase, specifically, which is right. I am looking at making a simple and customized Document Management System for my organization. Basically, we need the ability to store some Word Documents, PDFs and other similar files. I also want to store metadata about these files (e.g., Author, Dates, etc). Usage permissions would also be handy, but that can probably be built using meta-data. I would also need the ability to full-text index. The ability to version, while not required would be extremely useful. I would like the ability to simply add hardware to expand the resources of the system and the system must support Network Attached Storage over the CIFS or NFS protocol(s). I have read about CouchDB, HDFS and HBase. My preferred programming language is C# as all of my end-users will be running Windows machines and I will want to make both web and winforms client implementations. My question is which solution best fits my needs? Based on my research it appears that CouchDB (utilizing the CouchDB-Lounge and CouchDB-Lucene) perfectly fits my needs. However, I am worried that since I have worked with CouchDB that I might be overlooking something useful for my needs in HDFS or HBase or something similar due to a bias. Any and all opinions are welcome as I am looking for the community input as I really do not want to make the wrong choice at the start of my project. Please ask if you need more information. I thank you all for your time, input and assistance.

    Read the article

  • Code to strip diacritical marks using ICU

    - by Paul J. Lucas
    Can somebody please provide some sample code to strip diacritical marks (i.e., replace characters having accents, umlauts, etc., with their unaccented, unumlauted, etc., character equivalents, e.g., every accented é would become a plain ASCII e) from a UnicodeString using the ICU library in C++? E.g.: UnicodeString strip_diacritics( UnicodeString const &s ) { UnicodeString result; // ... return result; } Assume that s has already been normalized. Thanks.

    Read the article

  • Help with ZK component development

    - by Lucas
    I'm developing a simple component. My jar structure is: br/netsoft/zkComponents/Tef.class META-INF/MANIFEST.MF metainfo/zk/lang-addon.xml web/js/br/netsoft/zkComponents.js web/zkComponents/tef.dsp My dsp file is: <c:set var="self" value="${requestScope.arg.self}"/> <span z.type="br.netsoft.zkComponents.Tef" id="${self.uuid}" ${self.outerAttrs}${self.innerAttrs}> <applet archive="tef.jar" id="tefApplet" code="br.netsoft.applets.tef.TEFProxy" width="0px" height="0px" /> <span/> and the language-addon.xml is: <language-addon> <addon-name>componentes</addon-name> <language-name>xul/html</language-name> <component> <component-name>tef</component-name> <component-class>br.netsoft.zkComponents.Tef</component-class> <mold> <mold-name>default</mold-name> <mold-uri>~./zkComponents/tef.dsp</mold-uri> </mold> </component> </language-addon> When i try to test this component, appears a pop-up showing : " /js/br/netsoft/zkComponents.js not found" what is wrong?

    Read the article

  • FileReader File not Found Java

    - by Lucas Camargo de Carvalho
    I have done everything I know. The file is not a ".filetype.filetype". It is in the same folder as the .settings and the other project files. Why is this not working? Full path isn't working either, but strangely, a Scanner is working. import java.io.FileReader; public class test { public static void main(String[] args) { FileReader testFileReader = new FileReader("hotels.json"); } }

    Read the article

  • Check if Django model field choices exists

    - by Justin Lucas
    I'm attempting to check if a value exists in the choices tuple set for a model field. For example lets say I have a Model like this: class Vote(models.Model): VOTE_TYPE = ( (1, "Up"), (-1, "Down"), ) value = models.SmallIntegerField(max_length=1, choices=VOTE_TYPES) Now lets say in a view I have a variable new_value = 'Up' that I would like to use as the value field in a new Vote. How can I first check to see if the value of that variable exists in the VOTE_TYPE tuple? Thank you.

    Read the article

  • Using UNINSTALL_SHORTCUT Intent

    - by Lucas S.
    I am trying to use the following intent action, but i get an ActivityNotFoundException in the fisrt case. And nothing at all in the second case. "com.android.launcher.action.UNINSTALL_SHORTCUT" I try to use it with the following code: Intent i = new Intent ("com.android.launcher.action.UNINSTALL_SHORTCUT"); startActivity(i); Also with the following: Intent i = new Intent ("com.android.launcher.action.UNINSTALL_SHORTCUT"); sendBroadCast(i);

    Read the article

  • .htaccess mod_rewrite is preventing certain files from being served

    - by Lucas
    i have a successful use of mod_rewrite to make a site display as i wish... however, i have migrated the 'mock-up' folder to the root directory and in implementing these rules for the site, some files are not being served in the ^pdfs folder: RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] (old directory) RewriteRule ^redesign_03012010/mock-up/([^/]+)/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1&section=$2 [PT] RewriteRule ^redesign_03012010/mock-up/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1 [PT,L] (new directory) RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1&section=$2 [PT] RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [PT,L] ... ^pdfs (aka /pdfs/) is not serving the files... any suggestions?

    Read the article

  • What is difference between my atoi() calls?

    - by Lucas
    I have a big number stored in a string and try to extract a single digit. But what are the differences between those calls? #include <iostream> #include <string> int main(){ std::string bigNumber = "93485720394857230"; char tmp = bigNumber.at(5); int digit = atoi(&tmp); int digit2 = atoi(&bigNumber.at(5)) int digit3 = atoi(&bigNumber.at(12)); std::cout << "digit: " << digit << std::endl; std::cout << "digit2: " << digit2 << std::endl; std::cout << "digit3: " << digit3 << std::endl; } This will produce the following output. digit: 7 digit2: 2147483647 digit3: 57230 The first one is the desired result. The second one seems to me to be a random number, which I cannot find in the string. The third one is the end of the string, but not just a single digit as I expected, but up from the 12th index to the end of the string. Can somebody explain the different outputs to me? EDIT: Would this be an acceptable solution? char tmp[2] = {bigNumber.at(5), '\0'}; int digit = atoi(tmp); std::cout << "digit: " << digit << std::endl;

    Read the article

  • python-iptables: Cryptic error when allowing incoming TCP traffic on port 1234

    - by Lucas Kauffman
    I wanted to write an iptables script in Python. Rather than calling iptables itself I wanted to use the python-iptables package. However I'm having a hard time getting some basic rules setup. I wanted to use the filter chain to accept incoming TCP traffic on port 1234. So I wrote this: import iptc chain = iptc.Chain(iptc.TABLE_FILTER,"INPUT") rule = iptc.Rule() target = iptc.Target(rule,"ACCEPT") match = iptc.Match(rule,'tcp') match.dport='1234' rule.add_match(match) rule.target = target chain.insert_rule(rule) However when I run this I get this thrown back at me: Traceback (most recent call last): File "testing.py", line 9, in <module> chain.insert_rule(rule) File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1133, in insert_rule self.table.insert_entry(self.name, rbuf, position) File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1166, in new obj.refresh() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1230, in refresh self._free() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1224, in _free self.commit() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1219, in commit raise IPTCError("can't commit: %s" % (self.strerror())) iptc.IPTCError: can't commit: Invalid argument Exception AttributeError: "'NoneType' object has no attribute 'get_errno'" in <bound method Table.__del__ of <iptc.Table object at 0x7fcad56cc550>> ignored Does anyone have experience with python-iptables that could enlighten on what I did wrong?

    Read the article

  • Mockito verify no more interactions but omit getters

    - by michael lucas
    Mockito api provides method: Mockito.verifyNoMoreInteractions(someMock); but is it possible in Mockito to declare that I don't want more interactions with a given mock with the exceptions of interactions with its getter methods? The simple scenario is the one in which I test that sut changes only certain properties of a given mock and lefts other properties untapped. In example I want to test that UserActivationService changes property Active on an instance of class User but does't do anything to properties like Role, Password, AccountBalance, etc. I'm open to criticism regarding my approach to the problem.

    Read the article

  • JBoss Clustered Service that sends emails from txt file

    - by michael lucas
    I need a little push in the right direction. Here's my problem: I have to create an ultra-reliable service that sends email messages to clients whose addresses are stored in txt file on FTP server. Single txt file may contain unlimited number of entries. Most often the file contains about 300,000 entries. Service exposes interface with just two simple methods: TaskHandle sendEmails(String ftpFilePath); ProcessStatus checkProcessStatus(TaskHandle taskHandle); Method sendEmails() returns TaskHandle by which we can ask for ProcessStatus. For such a service to be reliable clustering is necessary. Processing single txt file might take a long time. Restarting one node in a cluster should have no impact on sending emails. We use JBoss AS 4.2.0 which comes with a nice HASingletonController that ensure one instance of service is running at given time. But once a fail-over happens, the second service should continue work from where the first one stopped. How can I share state between nodes in a cluster in such a way that leaves no possibility of sending some emails twice?

    Read the article

  • Starting and stopping firefox from c#

    - by Lucas Meijer
    When I start /Applications/Firefox.app/Contents/MacOS/firefox-bin on MacOSX using Process.Start() using Mono, the id of the process that gets returned does not match the process that firefox ends up running under. It looks like firefox quickly decides to start another process, and kill the current one. This makes it difficult to stop firefox, and to detect if it is still running. I've tried starting firefox using the -no-remote flag, to no avail. Is there a way to start firefox in such a way that it doesn't do this "I'll quickly make a new process for you" dance? The situation can somewhat be detected by making sure Firefox keeps on running for at least 3 seconds after its start, and when it does not, scan for other firefox processes. However, this technique is shaky at best, as on slow days it might take a bit more than 3 seconds, and then all tests depending on this behaviour fail. It turns out, that this behaviour only happens when asking firefox to start a specific profile using -P MyProfile. (Which I need to do, as I need to start firefox with specific proxyserver settings) If I start firefox "normally" it does stick to its process.

    Read the article

  • NHibernate and hbm2dll update attribute

    - by michael lucas
    Hi, i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name="hbm2ddl.auto" value="update"/> But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen. If i want missing tables geenrated I have to set hbm2dll.auto property to "create" which is not an option for me since it drops existing db content beforehand. I experienced the same problem with PostgreSql problem. Am I missing something?

    Read the article

  • How can you tell if a person is a programmer?

    - by Lucas Jones
    I was wondering when I read the famous "Programmer Habits" thread, I was wondering: Is there any way to tell if somebody is a programmer without actually asking them? Clarification: I am asking for things that you can use to recognise a programmer from "afar" or without knowing them well. To identify habits, you need to be around a person for a certain amount of time.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11  | Next Page >