danielkza
Active Members-
Posts
422 -
Joined
-
Last visited
About danielkza
- Birthday 10/27/1992
Profile Information
-
Location
São Paulo, Brazil
danielkza's Achievements
Universalist (7/7)
10
Reputation
-
gi_jimbo reacted to a post in a topic:
Setting PNG file to an image pic Control?
-
Translating a SQL call from AutoIt to C#
danielkza replied to JLogan3o13's topic in AutoIt Technical Discussion
You should also check LINQ to SQL. -
You could try Qt, GTK, or wxWidgets.
-
Did you disable optimizations in the compilation options for the Debug configuration?
-
Calculating date/time relative to UTC
danielkza replied to 4Eyes's topic in AutoIt General Help and Support
0: Timezone doesn't have DST at all. 1: Timezone has DST, but it is not in effect. 2: Timezone has DST, and it is in effect. -
My remark applies even if you want the whole CPU information. Performance is irrelevant since you never need to do it more than once: use WMI which is the easy route, or DLLCall some other library, there's no point in trying to do it in assembly yourself.
-
Why would you ever need to get the VendorID more than once?
-
If the algorithm can be trivially converted to an iterative version (mostly tail recursive algorithms e.g. a factorial function) that is usually true. But for algorithms involving backtracking and/or that need a manual stack in iterative form that may not always be the case: you need to consider the effects of replacing the very optimized native call stack with your own version, how cache locality will affect the performance, etc. For example, if you're targeting an ABI which can pass function arguments through registers, using a manual stack may force the compiler to perform multiple memory reads and writes instead of simply keeping the parameters in registers, possibly untouched, between recursive calls.
-
I like DroidEdit.
-
You should not call strlen twice for the same string if it wasn't change in between: each call will walk the whole string counting the length, and there's no need to do that twice (you repeat that same mistake on your sample usage code). Cache the result in a variable instead. Also, when the offset is larger than the string length you should store an empty string or return some kind of error code, otherwise code that tries to reuse the same memory for multiple calls will wrongly re-use the result of previous operations in some cases. Finally, why the static_cast on the foor loop? It's completely unecessary.
-
jaberwacky reacted to a post in a topic:
[JS] UserScript / Chrome Browser Extension
-
[JS] UserScript / Chrome Browser Extension
danielkza replied to Skitty's topic in AutoIt Technical Discussion
I actually (mostly) like Javascript as a language, ignoring the confusing web-browser stuff. I'm personally like writing code using anonymous and nested functions, closures, etc. It's very far from perfect though: the (lack of) a class system makes object-oriented programming much harder than it should be (that's one of the reasons CoffeeScript and other languages that compile to JS are getting popular), the weak typing system causes unexpected gotchas and weird behavior (I'm not even talking about the lack of static typing: Python has completely dynamic typing, but blows up whenever you try to mix up incompatible types instead of giving you retarded results), the (lack of proper) scoping is a mind-boggling oversight, etc. CoffeeScript is the name of the language you mention. Most of it translates in a straight-forward way to vanilla Javascript: most of the converted code I see doesn't look as bad as this example. I wonder if it was actually bad CoffeeScript to begin with.- 9 replies
-
- extension
- javascript
-
(and 4 more)
Tagged with:
-
If you freed the result string the callee would have nothing to work with. It's the callee's job to determine the lifespan of the created string and dispose of it accordingly. And I notice a bug: the passed offset may be larger than the length of the string, which would cause the result of the max calculation to be negative, which cannot be stored in an unsigned size_t, leading to a wrap to what is possibly a very large number (close to UINT_MAX, which is about 4 billion), which is definitely will cause unexpected behavior. Fixing that is actually not that hard: you could either compare the string length and the offset and fail early, or make max signed and check if it's actually non-negative before continuing. Also, the proper spelling is 'length'
-
[JS] UserScript / Chrome Browser Extension
danielkza replied to Skitty's topic in AutoIt Technical Discussion
It declares an anonymous function, wrapped in parenthesis so you can call it right away. This: (function (s) { alert(s); })("hello"); would show you a 'hello' message box.- 9 replies
-
- extension
- javascript
-
(and 4 more)
Tagged with:
-
JohnOne reacted to a post in a topic:
Regex - Visual studio 2010 >
-
An example for you (tested only on VS2012). It's not particularly complicated if you know C++ already, just a bit verbose, but that's usually the price for the good stuff in C++. #include <string> #include <iostream> #include <regex> int main(int argc, char **argv) { std::string data("a.b.c.d"); std::regex pattern("([^.])+(.|$)"); std::regex_iterator<std::string::iterator> it(data.begin(), data.end(), pattern); for(; it != decltype(it)(); ++it) { auto match = *it; if(!match.empty()) std::cout << match[1].str() << std::endl; } return 0; }
-
Programs usually just check for the existence and the value of an environment variable without creating it, much less saving it to your personal, permanent environment (which is the one you can edit from the Control Panel). Which means you need to know in advance which variables which program tries to use. What exactly do you want to be Global and per-User?
-
What I do is keep SciTEUser.properties in SciTE's directory and add import SciTEUser to the end of the Global options file. Unfortunately you still have to deal with the session file. And from your writing I can't be sure if you don't want to change USERPROFILE particularly or any env. var at all, but in the first case, you can set SciTE_Home instead (ignore me if you knew that already).