 |
 |
 |
What is the last thing you thought?, Tech Edition |
|
Aug 4 2015, 23:05
|
io9io9io9
Newcomer
  Group: Members
Posts: 62
Joined: 4-August 15

|
the last thing i thought is maybe i should reevaluate my opinion on dank gangsters.
|
|
|
Aug 7 2015, 04:53
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
The person who wrote a screensaver for the xscreensaver that blanks your screen and displays text simulating a kernel panic have probably caused a dozen heart attacks. I almost had on today.
|
|
|
Aug 7 2015, 07:25
|
Pillowgirl
Group: Gold Star Club
Posts: 5,458
Joined: 2-December 12

|
QUOTE(blue penguin @ Aug 7 2015, 12:53)  simulating a kernel panic
(IMG:[ i.imgur.com] http://i.imgur.com/0gRslTC.png)
|
|
|
Aug 16 2015, 03:37
|
EsotericSatire
Group: Catgirl Camarilla
Posts: 12,763
Joined: 31-July 10

|
Used to do that prank to people on Win95.
|
|
|
Aug 16 2015, 05:41
|
S.A.V.
Group: Gold Star Club
Posts: 478
Joined: 28-June 15

|
coconuts
|
|
|
Aug 16 2015, 08:18
|
_oniichan_
Newcomer
  Group: Gold Star Club
Posts: 54
Joined: 11-May 15

|
Today at work I learned (the hard way) that PHP's "empty(STRING_VAR)" function returns true if the input is "0". The amount of rage I feel is indescribable.
Surely, I should have assumed that a function designed to check for string with no content ([ 0x00 ] strings) would have an exception when it has THE SPECIFIC value of [ 0x30, 0x00 ]. Perfectly reasonable logic, makes 100% sense, totally don't have to go through piles of code looking for potential bugs caused by that random exception, not at all!
Just another reason to add to the "Why I never use PHP outside of work!" list.
|
|
|
Aug 16 2015, 11:25
|
elda88
Group: Gold Star Club
Posts: 16,199
Joined: 30-June 09

|
Is there any hack to force the LibreOffice installer to install only Writer? For personal work purposes, I really don't need spreadsheets and presentation program.
|
|
|
Aug 16 2015, 14:07
|
safasfdsfas
Newcomer
  Group: Members
Posts: 71
Joined: 21-January 12

|
butt
|
|
|
Aug 16 2015, 17:19
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
QUOTE(_oniichan_ @ Aug 16 2015, 07:18)  Just another reason to add to the "Why I never use PHP outside of work!" list. I imagine you never tried Perl. QUOTE(hujan86 @ Aug 16 2015, 10:25)  Is there any hack to force the LibreOffice installer to install only Writer? For personal work purposes, I really don't need spreadsheets and presentation program. Yes, CentOS and Arch Linux package manages separate the LibreOffice into pieces. Not that i believe this info will help you, but hey, i'm an engineer.
|
|
|
|
 |
|
Aug 21 2015, 02:55
|
InMuenchenSteht
Lurker
Group: Recruits
Posts: 5
Joined: 21-August 15

|
As a personal challenge, I've decided to write a VM in C++. I've written register-based VMs in the past, but what I have in mind is very different. I'd like to write something similar to the Python VM. That is, a stack machine. The VMs I've written have all operated on fixed word sizes and treated everything as a number. You know, how most processors work.
Anyway, the problem I've been running into is pretty fundamental to the VM's design. I'm trying to figure out how to do the data for the stack. I have two ideas, one involves a god object-type-thing that will basically hold one instance every kind of data that the machine is designed to operate on (integers, strings, floats, arrays, hashs, and (maybe) function pointers) and push that onto the stack by value. The other is dynamically allocating those storage objects and pushing a pointer to the object onto the stack.
Both of these have a few advantages and disadvantages from a programming perspective. The former is, at least from the outset, easier to manage. I don't have to worry about allocating and deleting objects and I won't have to deal with performance overhead of C++ new/delete operators. On the other hand, god-objects are a bad programming practice and make things less modular. This method means I can't use polymorphism, because that only works with pointers.
The latter is more complicated to manage in terms of memory, particularly, "when should I delete the allocated object?" Not to mention the fact that new/delete are inefficient, though thread-safe if done right. The major advantage to this, is that I can have a generic "VMObject" object from which I can derive as many other objects as I want. This makes the code more modular.
Sorry for the tome. I need to go through the Python and Lua virtual machine source code to get an idea of what to do.
This post has been edited by InMuenchenSteht: Aug 21 2015, 02:56
|
|
|
|
 |
|
Aug 21 2015, 03:15
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
^ your difficult point seem to be around making things thread safe. I really hope you're not trying to write a VM and then make it run green threads. Don't overdo a VM, simple VMs can do a lot. Although i hate to admit it, the Java VM is much more advanced and faster than Python. On the other hand, Python still runs faster than Java in most situations. How the fuck is that possible? Python VM is much smaller and depends on the OS a lot, therefore syscalls happen quicker in Python. Do not be afraid of depending on the OS. Also, have you seen [ www.amazon.com] this book? I've read only the first couple of chapters but it seemed pretty good for what you're trying to do.
|
|
|
|
 |
|
Aug 21 2015, 04:52
|
InMuenchenSteht
Lurker
Group: Recruits
Posts: 5
Joined: 21-August 15

|
Thanks for the book suggestion. I'll be putting it on my wish list for next amazon purchase. Thread safety is more of an after thought for me. It's not something I was really designing into the VM from the start. I think my main sticking point is actually how to implement the stack. Do I go with the by value approach or do I go for the dynamic allocation approach? I write quite a bit of C++, but, amazingly, I rarely use new/delete. Mostly what I'm concerned about how things will work if I allocate and deallocate objects on almost every stack operation, or even worse, if I don't deallocate the objects. For the few stack machines I've written, I use the by value approach, because I'm just dealing with integers. Here's an example. Let's say the current instruction pushes an integer onto the stack. Well, normally, I would just directly push that integer onto the stack, because that's what the stack is designed to work with. In this case, I'd like to support more datatypes. So, do I end up with something like CODE case PUSH_I: stack->push(new PrimitiveObject(INTEGER, ins_parameter)); break;
In that case, when should I delete on that object? Right after I'm done using it? If so, then I'm going to deleting objects on basically every instruction. If I were to set an integer to a variable, I would have to push a string (variable name) to the stack, then the integer, then pop both immediately afterwards. I've performed two allocations and deallocations. It just doesn't seem right. What do you suggest? I feel like I am missing something key. EDITHaving read more of the Python source, I think I have a better idea of how it works. I don't know why, but it didn't really make sense to me earlier, today. Maybe it's me posting about it and prompting me to mull it over, more. Regardless, I think I see how Python handles things with regard to the stack. For one, it's in C, which means no new/delete. But, it looks like, instead of allocating and deallocating space, it just shuffles pointers around. So, in the "set variable to an integer" example, the Python VM just takes a pointer to the already existing integer in the constant pool and a variable reference, as opposed to allocating new space. This post has been edited by InMuenchenSteht: Aug 21 2015, 05:05
|
|
|
|
 |
|
Aug 21 2015, 06:45
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
Well, pretty much every VM has a garbage collector (a daemon thread that executes when the program is more or less idle). And, i guess, that gives a huge advantage to the dynamic allocation approach. At some point your garbage collector needs to go through all objects (that's hardly true, in reality there are several algorithms that allow it to go through specific objects) and check whether there are any references to them. This means there must be some structure that keeps count of the number of references to the object. This structure must also be small and of fixed size since the garbage collector needs to go through thousands of those quite quickly. A structure that has a reference counter and a pointer to the actual object seems perfect for the job. As all objects were create by some form of a malloc call their memory is mapped, what the garbage collector needs to figure out is when to call free on them. If the structure has the reference counter, it needs to be properly updated: every variable assignment checks if it needs to assign (+1) or remove (-1) references, and every end of scope checks all variables to remove references of all the variables that become out of scope. If the counter in the structure is properly updated all the garbage collector needs to do is to call free on the pointer of every structure that has the reference counter as zero (and then call free again on the strcuture itself possibly tidying up some list). ------ And yes, Python does several tricks to avoid creation of many identical objects. Since in Python this: CODE a = 3 a += 1 First creates an object "3" and references it from "a", then adds 3+1 and creates an object for the result (4) which only then is referenced as "a" (and the reference to "3" is removed). At some later point the garbage collector will pick up the object "3" and free the memory that object occupies. Given this behaviour every time Python creates a new small integer or a short string it just references an existing object, wherever that object is. This seems mad but it is quite clever, since the objects do not change but every change in them results in the creation of new objects, these objects are immutable. And immutable objects will never change (by definition) so it is completely safe to re-reference them somewhere else. This is a trick in Python, yet not a common thing in VMs, neither it is really needed to build a simple VM. Nevertheless, it is fun.
|
|
|
|
 |
|
Aug 21 2015, 19:05
|
elda88
Group: Gold Star Club
Posts: 16,199
Joined: 30-June 09

|
It seems that OOXML version of the same of document always has a smaller file size compared to ODF.
|
|
|
Aug 25 2015, 06:54
|
elda88
Group: Gold Star Club
Posts: 16,199
Joined: 30-June 09

|
QUOTE(hujan86 @ Aug 16 2015, 17:25)  Is there any hack to force the LibreOffice installer to install only Writer? For personal work purposes, I really don't need spreadsheets and presentation program.
QUOTE(blue penguin @ Aug 16 2015, 23:19)  Yes, CentOS and Arch Linux package manages separate the LibreOffice into pieces. Not that i believe this info will help you, but hey, i'm an engineer.
Submitted the request through Bugzilla. Hopefully they'll listen.Update: The developer said they'll never implement such a feature. So, it's either going back to MS Office or Softmaker Office. This post has been edited by hujan86: Aug 25 2015, 11:07
|
|
|
Aug 28 2015, 04:01
|
elda88
Group: Gold Star Club
Posts: 16,199
Joined: 30-June 09

|
US$650 for a Radeon R9 Nano? That's equivalent to 2730 in local currency. Oh well, I'll just stick to my HD7870 for now.
|
|
|
Aug 28 2015, 13:41
|
Necromusume
Group: Catgirl Camarilla
Posts: 7,202
Joined: 17-May 12

|
Checked the Ashley Madison torrents and it turned out my hand had an account. I... I just don't know what to think...
|
|
|
Aug 28 2015, 22:15
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
QUOTE(mechafujoshi @ Aug 28 2015, 12:41)  Checked the Ashley Madison torrents and it turned out my hand had an account. I... I just don't know what to think... It is time to start using the left hand
|
|
|
Aug 29 2015, 08:08
|
Necromusume
Group: Catgirl Camarilla
Posts: 7,202
Joined: 17-May 12

|
It had an affair with my left hand, and both my feet. Well, I've got an idea. They can't get away from me, so I'm just gonna start raping all of them.
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
|
 |
 |
 |
|