Jump to content

Unimportant

Member
  • Posts

    1,230
  • Joined

  • Last visited

Reputation Activity

  1. Agree
    Unimportant reacted to UndueHatred in What to do with old HHD?   
    Crack it open and dig the magnets out. Work great for magnetic trays and the like. 320GB is it SATA? 1, 2, or 3? Seriously. Just crack it open, HDD's are very cheap.
  2. Like
    Unimportant got a reaction from ThinkWithPortals in Does anyone know what this song is?   
    Half life 2 OST - Triage at dawn.
  3. Like
    Unimportant got a reaction from minibois in Does anyone know what this song is?   
    Half life 2 OST - Triage at dawn.
  4. Agree
    Unimportant reacted to Nineshadow in help a newbie in coding in C++   
    Computers already store numbers in binary, it's not like we use decimal computers these days, and you can use bit manipulation directly to get the results you're looking for.
    Read about binary operators in C/C++ here : https://www.tutorialspoint.com/cprogramming/c_bitwise_operators.htm
    Anyway, the program could look something like this :
    int d,i,b[32]; int main() { cin>>d; while(d){ b[i++]=d&1; d>>=1; } for(i--;i>=0;--i) cout<<b[i]; } Let's consider a variable x.
    If you apply the binary operator AND, &, with a 1, more exactly if you do x&1, this will give you the last bit in the binary representation of x.
    The binary right shift operator gets rid of the least significant bit in the number, and shifts the entire binary representation to the right by however bits you specify it to. Consider x =0b1010=10. x>>1=0b101=5. x>>2=0b10=2. x>>3=0b1=1. x>>4=0b0=0. I think you should get it by now. Also, essentially, x>>y=x/2y.
    With these in mind, you should understand what's going on in the code above.
     
    Note: the end result in the array b is the binary representation of d, but in reverse order. That's why I printed its values in reverse.
     
  5. Agree
    Unimportant reacted to meenmeen1103 in Soldering prodjects for a beginner   
    The most useful thing is to practice first is to solder two ends of thin (14-18awg) wires together and have it look neat, without melting the insulation. That helps you be quick and still effective when low heat is needed.
     
    Then this
     
  6. Agree
    Unimportant reacted to Pinguinsan in C++ How does this piece of code work(pointers and char arrays)?   
    "mutable" and "immutable" in the context of this type of programming refers to whether it can be changed or not. To "mutate" something is to change it. So all const declared variables are immutable by definition: they cannot be changed:
     
    const int myInt = 5; myInt = 10; //ERROR! myInt is declared const, and thus immutable When he mentions that it "decays into a pointer", it's important to note that the terminology can get sticky in the context of C++. Technically, C++ has a standard library feature called std::decay, but it is way above the scope of this conversation. The basic idea of something "decaying into a pointer" is that something is implicitly converted to something else. The very basic example is of declaring a pointer to an already existing array.
     
    int myInts[5] = {0, 5, 3, 4, 6}; //Declare an integer array of 5 elements int *intPtr = myInts; //Here is where the decay happens. myInts is the exact same as &myInts[0] The basic idea here is that when you use an array without any brackets (ie myInts[3]), it "decays" into a pointer to the first element in the array. So as the comment mentiones, myInts[0] accessed the first element, and &myInts[0] takes the address of the first element. As said before, using myInts without any brackets returns a pointer to the first element. Therefore, myInts is the same as writing &myInts[0].
  7. Agree
    Unimportant reacted to Huntsman in Custom-built compact speakers   
    I'm not a sound engineer but I used to work at a PA company back in high school. They like to stuff thick woolly cotton sheets into their speakers. Line the surfaces inside and claims it sounds better...
     
    I don't know.. give it a try maybe?
  8. Agree
    Unimportant got a reaction from Artechz in Custom-built compact speakers   
    Polyester fill.
  9. Like
    Unimportant got a reaction from ¨TrisT¨ in C++ How does this piece of code work(pointers and char arrays)?   
    They're not.
    The first is a pointer, pointing to a string literal "Hello". The pointer itself is mutable.
    The second is a char array, initialized with the content "Hello". It decays into a pointer but is immutable:
    const char *myChar1 = "Hello"; const char myChar2[] = "Hello"; char c = 'a'; myChar1 = &c; //OK! myChar2 = &c; //error! //also... sizeof(myChar1) == sizeof(void*) //while... sizeof(myChar2) == 6 On many machines with Harvard architecture this can have the side-effect that while the string "Hello" itself might be put in ROM or flash memory, there will still be a pointer created in RAM for "myChar1". For large projects with lots of these string literals this can end up using a lot of RAM needlessly.
  10. Like
    Unimportant got a reaction from ¨TrisT¨ in C++ How does this piece of code work(pointers and char arrays)?   
    It does not. It makes it a pointer. In C, a string is nothing more then a row of char's. The char pointer points to the beginning of the string and a 0 (not '0') indicates the end of the string.
     
     
     
    It takes the memory address of "now" because the function expects a time_t pointer.
    "now" is the actual element , of type time_t.
    "&now" is the memory address of "now", of type time_t*.
    It means the function expects a time_t pointer like explained above. The "const" means the function promises not to modify the data inside the time_t structure you hand it a pointer to. (Simply put, the function promises not to change the contents of "now").
     
    It's the same as the char* thing. It means "gmtm" is a pointer.
  11. Agree
    Unimportant got a reaction from Huntsman in Hardware USB Thumbdrive Formatter   
    When using a simple micro-controller such as a PIC or AVR the chance of that is zero.
    First of all, many of these micro-controllers can't write to their own program memory, programming is done with a external programmer device. So any virus or "payload" is physically incapable of nesting itself in the device's firmware. Micro-controllers that can write their own flash for boot-loader purposes can have their flash write-protected with the same end result.
     
    And, of course, even if it were possible, any such malware would have to be programmed to specifically target the micro-controller architecture in question. No malware writer is going to waste time targeting a platform with such a small user-base. (unless the device would end up being popular and mass produced).
  12. Agree
    Unimportant got a reaction from jk_mi in Is Cash Further Loosing to Tech in Retail   
    One reason and one reason alone. The FED is stuck with near zero interest rates. And after years and years of shouting they'll raise 'em soon they're still stuck near zero. They cannot raise rates as the giant ball of global debt will explode when they do. Thus, in the next crisis/recession they'll have to cut rates toward negative territory. Negative interest rates will however cause ppl to just get their money off the bank. Better to stuff it under the mattress then actually PAY interest on your money in the bank, right? 
     
    So, slowly but surely they're pushing to remove cash so that once they go negative on interest rates everyone is stuck with no way out.
  13. Like
    Unimportant got a reaction from Mr.Meerkat in I hope the US dollar plummets.   
    You mean deflate probably.
     
    Inflation = currency loses value = prices go up
    Deflation = currency gains value = prices go down
  14. Informative
    Unimportant reacted to fizzlesticks in Why are these calculations so slow to be performed?   
    It's new in C++14, you can use ' to separate groups of digits to make it more readable than trying to count how many zeros there are. Like we use a coma or period in the real world but those wouldn't work for various reasons so they chose '.
  15. Agree
    Unimportant reacted to Huntsman in Home-made Freeze Dryer   
    Why Rpi? A 3 buck microcontroller could do the job fine.. 1/10 the cost..
  16. Agree
    Unimportant reacted to Silverwolf_7 in How to check capacitance?   
    You can't check the values of a component if it is still installed in the circuit. The test signal that the multimeter sends out will find a different way around.
  17. Like
    Unimportant got a reaction from ClobberXD in How to output values of variables in JagPDF using C++   
    From what i can see at a quick glance at the JagPDF documentation, the text outputting functions take a "const char*" C-style string. You can use a stringstream to format your text and then extract the string from it and take it's char pointer as such:
     
    #include <sstream> //required for stringstream //... int x = 10; //Example int to print. std::stringstream sstr; //stringstream sstr << "Value of int x is: " << x; //Format stringstream as you normally would printing to cout. const char* Ptr = sstr.str().c_str(); //Extract string from stringstream with str() function and then... //...extract that string's char pointer with c_str(). //You can, off course, pass the pointer directly as well. Canvas.text(sstr.str().c_str());  
  18. Like
    Unimportant got a reaction from ClobberXD in Unresolved external error when using MessageBox() in Qt Creator (also how to statically link Qt project?)   
    You should use the QMessageBox class in QT.
     
    As for the static QT build: https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows
    Do note that building the QT static lib takes a long long time.
  19. Agree
    Unimportant got a reaction from rhyseyness in What an odd repair. $2,500 laptop killed by a tiny ceramic capacitor.   
    Back when i still had my repair business we used a bench power supply limited to a current that would not damage anything and a infrared camera.
     
    Those SMD caps light up like a christmas tree with only a few 100mA when they are shorted out.
     
    Nice board level repair, respect, any muppet can swap a board, THIS is repair.
  20. Informative
    Unimportant got a reaction from Dat Guy in C++ Coding, EXE in a EXE?   
    It is possible. Put the entire contents of the EXE file in a char array. (Write a tool to automate this). The array will be loaded to memory when your program is loaded and all you need then is a way to execute a image in memory rather then from file.
     
    It's rather complicated and I've never attempted it but it seems this guy wrote a function to do exactly that: http://www.rohitab.com/discuss/topic/31681-c-run-program-from-memory-and-not-file/
  21. Like
    Unimportant got a reaction from ClobberXD in Force application to run on single CPU core using C++   
    Qt behaves the same as MFC. When you lock up the main thread that runs the framework by having it run your benchmark code the dialog box will go blank and you get a "window not responding" message. The main/framework thread should never be kept busy so it can continue to process messages/events. So you'll need to do the actual work in a new thread anyway.
  22. Like
    Unimportant got a reaction from ClobberXD in Unresolved external error when using MessageBox() in Qt Creator (also how to statically link Qt project?)   
    Qt uses QString for all it's string requirements, best to familiarize yourself with QString.
     
    QMessageBox MessageBox; MessageBox.setWindowTitle("My message box!"); MessageBox.setText(QString("Current index is:") + QString::number(ui->comboBox->currentIndex())); MessageBox.exec(); QString::number is a static memberfunction which can create a new QString from a number. The new string is then appended to the other QString because QString overrides "operator +".
  23. Agree
    Unimportant reacted to Misanthrope in Linux + Windows Data on same hard drive?   
    Yes but it has to be the windows drive: While Linux can read and write files to windows drives the reverse isn't true: Windows usually can't read files on a Linux filesystem like ext4
  24. Like
    Unimportant got a reaction from Hackentosher in [NeoPixel Rainbow] I Can't Arduino, Send Help   
    "Wheel" is a function that your code tries to call but was never defined.
    You need to add the Wheel function to the top of your code.
     
    I'm guessing it's the function on lines 121 to 134 in this file:
    https://github.com/adafruit/Adafruit_NeoPixel/blob/master/examples/strandtest/strandtest.ino
  25. Agree
    Unimportant reacted to You_are_a_cunt in What amps do USB output?   
    Signal
    5 V DC
    Max. voltage    
    5.00 (USB 2.0)
    5.00 (USB 3.0)
    Max. current    
    0.5 A (USB 2.0)
    0.9 A (USB 3.0)
    3 A (type-C)
     
×