The Big Programming Thread - Page 682
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
WarSame
Canada1950 Posts
| ||
Animzor
Sweden2154 Posts
is this: char* name; the same as this? char *name; | ||
Manit0u
Poland17187 Posts
On November 26 2015 07:48 WarSame wrote: For example, one question asked - in what version did Java release Enum. I know Enums are a fairly basic class so I assumed they were released in the initial version, 1.0. They were released in 5.0 - released in 2004. Stuff like that always reminds me how not really modern the modern languages can be. When you think about it, lambda expressions and anonymous functions became the rage fairly recently and then you realize that Lisp had it all in the 60's... On November 26 2015 16:05 Animzor wrote: Quick question(C++): is this: the same as this? Yes. You can even write it as "char * name". At least it used to be like that so you better get a second opinion here. | ||
Deleted User 101379
4849 Posts
On November 26 2015 16:05 Animzor wrote: Quick question(C++): is this: the same as this? It is the same. There are just different opinions on where the asterisk should go. char* name; // name is a variable of the type pointer-to-char Some people prefer to think of it the first way while others think of it the second way. I think the more common and accepted way is "char *name", because it makes multiple declarations less ambiguous: char *name1, name2; // name1 is a pointer to char, name2 is a char (not a pointer) Side node: Avoid combining declarations, especially when pointers are involved. It doesn't improve performance or memory footprint, it just makes it harder to read the code. | ||
![]()
tofucake
Hyrule18969 Posts
| ||
solidbebe
Netherlands4921 Posts
![]() | ||
Gowerly
United Kingdom916 Posts
But then that's because I never declare more than one variable on a line. I find it aids readability if things are separate. | ||
mantequilla
Turkey775 Posts
npm install ~ mvn install package.json ~ pom.xml grunt ~ mvn compile gulp ~ ??? bower ~ ??? | ||
spinesheath
Germany8679 Posts
On November 26 2015 22:31 tofucake wrote: yeah putting the asterisk with the variable is the way I prefer because there isn't a type of char-pointer. It's best to be as explicit as possible when declaring. I don't think that's right. From the C++ standard: 9.3.2 The this pointer In the body of a non-static (9.3) member function, the keyword this is a prvalue expression whose value is the address of the object for which the function is called. The type of this in a member function of a class X is X*. If the member function is declared const, the type of this is const X*, if the member function is declared volatile, the type of this is volatile X*, and if the member function is declared const volatile, the type of this is const volatile X*. [ Note: thus in a const member function, the object for which the function is called is accessed through a const access path. —end note ] So it clearly says that "X*" is a type. Now obviously this excerpt talks about classes rather than chars, but I'd wager that the same thing applies for char* or any other pointer. At the very least usage suggests that pointers are types: when you typecast a pointer you include the asterisk. | ||
Blisse
Canada3710 Posts
![]() | ||
Manit0u
Poland17187 Posts
On November 27 2015 02:48 mantequilla wrote: N00B to javascript world here. Are these analogous? npm install ~ mvn install package.json ~ pom.xml grunt ~ mvn compile gulp ~ ??? bower ~ ??? Please don't confuse JavaScript with Java. The tools you mentioned in theory serve the same purpose but they're totally different beast. Also: npm install -> this one is used to install node dependencies and run them in order (like getting bower and gulp and then running them) bower install -> this thing grabs your javascript dependences according to the settings, if it finds conflicts (like 2 scripts requiring incompatible jQuery packages) it asks you to choose between available versions. I think it also does that for css but I'm not 100% sure (been a long time since I did any frontend work) gulp -> merges, compiles, minifies and uglifies your assets provided by the other two Usually in the project it's like that: npm install (grab bower and gulp and execute the following commands - based on package.json) -> bower install (grab all the js and css requirements for your package - based on something) -> gulp (compile sass/less to css, compile javascripts, merge everything, do some magic, put asset images and scripts in the right folders etc. - based on gulpfile.js). I believe that Grunt and Bower and/or Gulp are interchangeable. | ||
solidbebe
Netherlands4921 Posts
![]() Im trying to set up a win7/ubuntu dualboot (single drive) on my HP laptop, got both installed but I cant boot from ubuntu now. In the boot menu i can only select boot from drive which goes into win7. I cheched out all the bios settings but nothing apparent that might help. Anyone got any ideas?? | ||
Ropid
Germany3557 Posts
The UEFI's boot menu can also be edited to add several boot loaders from that partition to it. That can be done through the "efibootmgr" tool. I'll take a look at my stuff here locally and type up something more about what's going on and how to do work on it from within the environment you have when you boot the Ubuntu installation media and go to its desktop. | ||
Manit0u
Poland17187 Posts
![]() | ||
Ropid
Germany3557 Posts
Here's the partitions of my first drive which is the one with Windows on it: $ sudo parted /dev/sda print Partition number three is the EFI partition. Let's mount it and take a look at it: $ mkdir temp That "EFI/Boot/bootx64.efi" file is the default boot loader. That's the file that gets loaded by the UEFI if you didn't configure anything special. For me here, it's a copy of a file in the Microsoft folder. See here: $ diff -s EFI/Boot/bootx64.efi EFI/Microsoft/Boot/bootmgfw.efi I assume Ubuntu uses the grub boot loader. You probably see it somewhere in its own folder on the drive. You should compare files with diff and see if the Ubuntu installation has overwritten the EFI/Boot/bootx64.efi file or if it's still the Microsoft file. I hope it's the Microsoft file and you can just copy the grub one over it and then things are working. It's not scary as you have the original in the Microsoft folder to copy back if needed. There's a tool "efibootmgr" that can edit a list that's in the UEFI. That list has at first just that one entry for the default boot loader file, but you can add a bunch more to it. Those added entries should then show up in the boot menu of the UEFI. The "efibootmgr" tool is weird and I forgot how to use it. Also, I bet HP has issues in its UEFI and disregards what you would do with the efibootmgr tool. That's perhaps the reason that Ubuntu doesn't boot. EDIT: The Archwiki has an article about one particular HP laptop: https://wiki.archlinux.org/index.php/HP_EliteBook_840_G1 Even if UEFI, Arch Linux and (e.g.) GRUB are correctly configured and with the correct UEFI NVRAM variables set, the system will not boot from the HDD/SSD. The problem is that HP hard coded the paths for the OS boot manager in their UEFI boot manager to \EFI\Microsoft\Boot\bootmgfw.efi to boot Microsoft Windows, regardless of how the UEFI NVRAM variables are changed. Great work by HP's programmers. ![]() The article explains that this particular laptop has a BIOS update that introduced a setting named "customized boot" where you can enter the path+filename to an alternative boot loader. | ||
Manit0u
Poland17187 Posts
| ||
Ropid
Germany3557 Posts
A thing I forgot is "SecureBoot". That has to be disabled for alternative boot loaders to work, though there was something about Ubuntu supposedly being able to work with it enabled. | ||
Nesserev
Belgium2760 Posts
| ||
mantequilla
Turkey775 Posts
On November 27 2015 08:10 Manit0u wrote: Please don't confuse JavaScript with Java. The tools you mentioned in theory serve the same purpose but they're totally different beast. Also: npm install -> this one is used to install node dependencies and run them in order (like getting bower and gulp and then running them) bower install -> this thing grabs your javascript dependences according to the settings, if it finds conflicts (like 2 scripts requiring incompatible jQuery packages) it asks you to choose between available versions. I think it also does that for css but I'm not 100% sure (been a long time since I did any frontend work) gulp -> merges, compiles, minifies and uglifies your assets provided by the other two Usually in the project it's like that: npm install (grab bower and gulp and execute the following commands - based on package.json) -> bower install (grab all the js and css requirements for your package - based on something) -> gulp (compile sass/less to css, compile javascripts, merge everything, do some magic, put asset images and scripts in the right folders etc. - based on gulpfile.js). I believe that Grunt and Bower and/or Gulp are interchangeable. Inserting required css and javascript files into HTML document's head is done by hand, or with one of these build tools? | ||
Manit0u
Poland17187 Posts
On November 27 2015 17:37 mantequilla wrote: Inserting required css and javascript files into HTML document's head is done by hand, or with one of these build tools? By hand. You do something like that:
Now, you don't really have those files. All you have are unprocessed stylesheets and javascripts in non-public folder:
Now, launching bower + gulp (via npm) will perform those steps: 1. Download jquery, angular, bootstrap, pace js and css (and whatever elese you need) 2. Compile your sass to css 3. Merge all css into a single file, minify and output it into /assets/css/compiled.css 4. Merge all js, minify, uglify and output it into /assets/js/compiled.js This way you really link only a single file somewhere in your layout and don't have to worry about it since all the assets will be compiled into them. You just have to run npm install after deployment. During development you might need to run gulp manually each time your js/css changes unless you have an IDE in which you can set up file watchers to do it for you automatically in the background upon file save (jetbrains products have such a feature). | ||
| ||