|
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. |
lol, i did type in hentai one time but i remembered i gotta be careful coz im screenshotting to put in my project report
![[image loading]](http://i.imgur.com/M2Nvh1b.jpg)
yeah i do format sometimes but its more the case of me not knowing why those bits go where they do
i mean it asks me for a comma so i put one then it asks me for an EOAF wtvr the fuck that is so i put a ; and a } then it says hey yo you got a comma here gonna do somethin about it?!?
|
On April 18 2015 23:03 FFGenerations wrote:lol, i did type in hentai one time but i remembered i gotta be careful coz im screenshotting to put in my project report ![[image loading]](http://i.imgur.com/M2Nvh1b.jpg) yeah i do format sometimes but its more the case of me not knowing why those bits go where they do i mean it asks me for a comma so i put one then it asks me for an EOAF wtvr the fuck that is so i put a ; and a } then it says hey yo you got a comma here gonna do somethin about it?!? Just calm down and take it one symbol at a time. Find the matching ones (which I'm pretty sure that your IDE will do for you) and format it in whatever way you feel comfortable with.
$(document).ready(function () { $('#button').click(function () {
$.ajax({ url: 'generate', type: 'POST', dataType: 'text', data: $('#sortable2 .selectedItemImg').each(function (index, value) { alert("test22"); }), success: function (data) { alert("test44"); } }); });
return false; });
EDIT: For fun, the equivalent CoffeeScript: + Show Spoiler +$(document).ready -> $('#button').click -> $.ajax url: 'generate' type: 'POST' dataType: 'text' data: $('#sortable2 .selectedItemImg').each (index, value) -> alert "test22" success: (data) -> alert "test44" false
|
On April 18 2015 23:03 FFGenerations wrote:lol, i did type in hentai one time but i remembered i gotta be careful coz im screenshotting to put in my project report ![[image loading]](http://i.imgur.com/M2Nvh1b.jpg) yeah i do format sometimes but its more the case of me not knowing why those bits go where they do i mean it asks me for a comma so i put one then it asks me for an EOAF wtvr the fuck that is so i put a ; and a } then it says hey yo you got a comma here gonna do somethin about it?!?
Agree with the guys above here. Fix your formatting (particularly indentation) and those braces will make far more sense.
As for your commas in the initial exerpt, they weren't there randomly: what you were doing is passing a json object to your ajax. A json object is basically a dictionary (or map) and commas separate each dictionary item. The braces mark the start and end of the dictionary. You thus have
{ 'name1': value1, 'name2': value2, ... 'namen', valuen }
as your object that you pass in your function. Finally, because you also pass different parameters along, each parameter is separated from the next by a comma as well, resulting in functioncall( { json, object }, other, stuff );
If your complaint is that in general javascript has some horribly messy syntax, I agree. Whoever promoted javascript to a serverside programming language (*cough* node.js *cough*) should get shot, but client-side there is not much option: it is the only actual programming language that web browsers understand.
|
i literally feel like crying. i just went 4 hours completely hopelessly stuck on the same thing until someone on stackoverflowed replied , changed my syntax and it all gradually started to work. i was just so delirilously hopelessly distraught, motionless mourning at the screen like a ghoul just completely numb and sapped to the core
|
I'm currently working on a ff addon so I will never miss any of my favorite (sc2) streams again. 
http://i.imgur.com/FpbGpxR.png
It basically gives you a sidebar which keeps track of the online status of streamers. You can optionally have the addon play a sound or open the stream in a new tab once a user goes online. These features will work even when the sidebar is closed. In addition, the addon has an unobnoxious way of telling you that you might have missed a streamer going online when you choose to keep the sidebar closed and no tab for this user was opened.
I'm currently looking for ideas for more features.
|
nice dude cool ideal. i dont "follow" on twitch and was surprised when i cudnt find a list of people i subscribe so i end up with everyone on my bookmark bar and just click them from time to time lol
love the sound alert idea
|
Hi guys, I have a good amount of experience with LAMP stack, php, mvc frameworks, jquery, javascript and such and I am looking into learning "MEAN" and I have a couple questions:
From my own research, there seems to be 2 main "frameworks" for MEAN but by itself, you could technically work with just mongodb, expressjs, angular and node on its own together. So is there any point in really going with those advertised "MEAN" stacks? Like what do they offer versus just using the 4 together by myself?
Also, coming from a LAMP background, I originally started with procedural php programming before learning about mvc frameworks and all that jazz that made my life easier, would you recommend diving straight into working with frameworks (express) or just work with just node and angular instead (without express)?
|
why does callprintwriter(); (at least the write function) stop working if i put it where it currently is?
i cant see any reason for it to not work
the only thing i can think of is you need to close IOmage or Buffered graphic thing, but nothing really comes up on google.
callprintwriter(); prints to text file if i put it above the for loop. if i put it below (where it is now) then it does not work.
+ Show Spoiler + package main;
import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import static java.lang.Math.floor; import java.net.URL; import java.util.ArrayList; import javax.imageio.ImageIO;
/** * * @author J */ public class ImageController {
//int roundUp(int numToRound, int multiple) //{ // if(multiple == 0) // { // return numToRound; // } // // int remainder = numToRound % multiple; // if (remainder == 0) // return numToRound; // return numToRound + multiple - remainder; //} public static void controlImage(ArrayList<String> imageURLs) throws IOException, Exception {
// ArrayList <String> imageURLs = new ArrayList<>(); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //imageURLs.add("C:\\Users\\J\\Desktop\\test5.jpg"); //Integer totalHeight= 300*((Math.round(imageURLs.size()/6))); // //Integer totalHeight = imageURLs.size()*300/4; // //Integer totalHeight = 300*(roundUp(imageURLs.size(), 4)); // int arraySize = imageURLs.length(); //Integer totalHeight = (roundUp(imageURLs.size(),4))*200; //System.out.println(imageURLs.size()); //System.out.println(totalHeight); // height = numberofentries / 4 rounded up to the nearest multiple of 4 // height = numberofentries rounded up to the nearest 4, divided by 4, times 300px //Double heightMath= 200*((Math.ceil(Math.abs(imageURLs.size()/4.0)))); //Long heightMath= 300*(long)Math.floor(imageURLs.size() + 1d); //Integer totalHeight = (int) (double) heightMath; //double doubleimage = imageURLs.size(); //if ((doubleimage/4) == imageURLs.size()/4){ // totalHeight = totalHeight-200; //if (totalHeight < 300){ // totalHeight = 300; // } // int numberOfBoxes = imageURLs.size(); // int totalHeight = gridFix(numberOfBoxes); // // int gridDepth = (int) Math.ceil(((double)numberOfBoxes)/4); // // int totalHeight = roundUp(gridDepth, 4)*200;
int totalHeight = ((int) Math.ceil(((double) numberOfBoxes - 1) / 4)) * 200;
BufferedImage result = new BufferedImage( 600, totalHeight, //work these out BufferedImage.TYPE_INT_RGB);
Graphics g = result.getGraphics();
Integer x = 0; Integer y = 0; Integer w = 150; Integer h = 200;
String generatedImageFilePath = "C:\\Users\\J\\Desktop\\resultimage.png";
for (String imageURL : imageURLs) {
URL url = new URL(imageURL);
BufferedImage bi = ImageIO.read(url); g.drawImage(bi, x, y, w, h, null); x += 150; if (x >= result.getWidth()) { x = 0; y += 200;
} try { ImageIO.write(result, "png", new File(generatedImageFilePath));
} catch (IOException e) { }
} callprintwriter(); }
private static int roundUp(int gridDepth, int multiple) { return (gridDepth + multiple) / multiple; }
private static int gridFix(int numberOfBoxes) { int gridDepth = (int) Math.ceil(((double) numberOfBoxes) / 4); return gridDepth; }
private static void callprintwriter() throws Exception {
PrintWriter writer2 = new PrintWriter("C:\\Users\\J\\Desktop\\imgurUploadData.txt", "UTF-8"); writer2.println("should work"); writer2.close();
Thread.sleep(5000); UploadController.getImgurContent("C:\\Users\\J\\Desktop\\resultimage.png");
//UploadController.getImgurContent(generatedImageFilePath); } }
|
Times like this are when you put an execution break and do some step-through debugging.
|
i dont know how to get that to work for a web app? ill try again
|
Hi all, anyone know a good way to convert a String in java to a Map<Character, Integer>. I can do it with a for loop, just was hoping there way some way I could do it with Streams.
Basically I want something equivalent to the python code:
indexes = {c:i for i,c in enumerate("0123456789")}
.
Tried following code in Java but it won't compile (reading function signatures these Stream functions makes my head hurt...).
String alphabet = "0123456789"; //Hoping something like below would work IntStream.range(0, alphabet.length()).collect(Collectors.toMap(alphabet::charAt, Function.identity());
Obviously it's not super important to not use a for-loop so plz spare me any comments about that.
edit: asked same on SO, got answer:
Map<Character, Integer> indexes = IntStream.range(0, alphabet.legth()).boxed().collect(Collectors.toMap(alphabet::chatAt, Function.identity());
Was missing the .boxed() call with gives Stream<T> which accepts collectors, vs IntStream which has a 3 arguement .collector. Now to figure out what it would look like without using the .boxed() calll...
edit2: Looks super long without using Collectors.toMap lol + Show Spoiler +
|
i might be figuring it out
i got to the point where i suddenly realise i have to access all my methods from the servlet (master location) so suddenly everything is different
this is the momentarily fun part of programming before i have to parse some more json
|
On April 19 2015 08:10 betaflame wrote: Hi guys, I have a good amount of experience with LAMP stack, php, mvc frameworks, jquery, javascript and such and I am looking into learning "MEAN" and I have a couple questions:
From my own research, there seems to be 2 main "frameworks" for MEAN but by itself, you could technically work with just mongodb, expressjs, angular and node on its own together. So is there any point in really going with those advertised "MEAN" stacks? Like what do they offer versus just using the 4 together by myself?
Also, coming from a LAMP background, I originally started with procedural php programming before learning about mvc frameworks and all that jazz that made my life easier, would you recommend diving straight into working with frameworks (express) or just work with just node and angular instead (without express)?
I'm curious, what are the two frameworks that you are referring to? I set up a MEAN environment a while back and I believe you definitely want to use Express, but I don't know enough to provide sound reasoning. But avoid reinventing the wheel whenever possible.
Since you already have experience with the LAMP stack, why don't you get some Angular experience using PHP as a backend instead of Node? I would recommend Laravel or their new micro framework Lumen. At least for me, it is easier to learn one thing at a time. (unless you already know angular, ignore this).
I think I am pretty decent at Angular, so if you have any questions PM me!
|
On April 19 2015 11:23 Rotodyne wrote:Show nested quote +On April 19 2015 08:10 betaflame wrote: Hi guys, I have a good amount of experience with LAMP stack, php, mvc frameworks, jquery, javascript and such and I am looking into learning "MEAN" and I have a couple questions:
From my own research, there seems to be 2 main "frameworks" for MEAN but by itself, you could technically work with just mongodb, expressjs, angular and node on its own together. So is there any point in really going with those advertised "MEAN" stacks? Like what do they offer versus just using the 4 together by myself?
Also, coming from a LAMP background, I originally started with procedural php programming before learning about mvc frameworks and all that jazz that made my life easier, would you recommend diving straight into working with frameworks (express) or just work with just node and angular instead (without express)?
I'm curious, what are the two frameworks that you are referring to? I set up a MEAN environment a while back and I believe you definitely want to use Express, but I don't know enough to provide sound reasoning. But avoid reinventing the wheel whenever possible. Since you already have experience with the LAMP stack, why don't you get some Angular experience using PHP as a backend instead of Node? I would recommend Laravel or their new micro framework Lumen. At least for me, it is easier to learn one thing at a time. (unless you already know angular, ignore this). I think I am pretty decent at Angular, so if you have any questions PM me!
You can learn all that in even smaller steps since you can use angular with php backend
|
On April 19 2015 11:23 Rotodyne wrote:Show nested quote +On April 19 2015 08:10 betaflame wrote: Hi guys, I have a good amount of experience with LAMP stack, php, mvc frameworks, jquery, javascript and such and I am looking into learning "MEAN" and I have a couple questions:
From my own research, there seems to be 2 main "frameworks" for MEAN but by itself, you could technically work with just mongodb, expressjs, angular and node on its own together. So is there any point in really going with those advertised "MEAN" stacks? Like what do they offer versus just using the 4 together by myself?
Also, coming from a LAMP background, I originally started with procedural php programming before learning about mvc frameworks and all that jazz that made my life easier, would you recommend diving straight into working with frameworks (express) or just work with just node and angular instead (without express)?
I'm curious, what are the two frameworks that you are referring to? I set up a MEAN environment a while back and I believe you definitely want to use Express, but I don't know enough to provide sound reasoning. But avoid reinventing the wheel whenever possible. Since you already have experience with the LAMP stack, why don't you get some Angular experience using PHP as a backend instead of Node? I would recommend Laravel or their new micro framework Lumen. At least for me, it is easier to learn one thing at a time. (unless you already know angular, ignore this). I think I am pretty decent at Angular, so if you have any questions PM me!
I am referring to MEAN.js and MEAN.io (http://meanjs.org/ http://mean.io/#!/) Apparently they are both made by the same guy but one of them was bought out by a company and he continued development by creating a new one instead..?
Yep, I've had some experience with Laravel but I've never heard of Lumen, I'll definitely check it out!
In terms of using angular, whats the core difference between just using typical javascript with jquery and templating on the front-end? Is it the maintainability and structure?
|
is it normal to talk in plural when you describe what you're doing in computer processes?
everything i write is like "We retrieve x and then do x. We put it on our local server. Send it back to our jsp"
to me its natural to talk like that , im not quite sure why. maybe it sounds really weird to some people, like what if my tutor thinks "what do you mean WE? arent you supposed to be working alone?"
|
On April 19 2015 12:16 FFGenerations wrote: is it normal to talk in plural when you describe what you're doing in computer processes?
everything i write is like "We retrieve x and then do x. We put it on our local server. Send it back to our jsp"
to me its natural to talk like that , im not quite sure why. maybe it sounds really weird to some people, like what if my tutor thinks "what do you mean WE? arent you supposed to be working alone?" That's like standard for all language, really. There's a really strong tendency to generalize statements that should be personal or first-person.
|
when i wake up im gonna 1) figure out how to host online 4reals (no clue whatsoever) 2) set up so my imagegenerator saves to an online url so i can pass this to imgur and have imgur host on my behalf 3) set up the parse the imgur url back to the user 4) clean up 5) probably that's it. no database. no validation. no secutiry. no error catching (or wtvr ppl do). just do the report and thats done!!! 6) do my 2nd assignment (i will have 2 days to do that). that is mobile application dev on X some mac bullshit thing 7) do my 3rd assignment (i will have less than 2 days to do that). that is formal mathematicals to formulate application logic/structure/testing using fucking mathematics . using an application called Perfect. anyone done that kind of stuff? its like, you design classes and stuff but using math and this special language . something like that. i'm so fucked. 8) after 4-5 days i wiill have finish uni barring 1 exam thing. idk if i will be able to do those assignments coz they wont be easy but they are already both Late. i just need 40/100 to pass but 2 days to do them especially fucking mATHS is gonna be a nightmare. im so delirious i was seeing spiders and flies earlier hallicinating . i still am. its reall hallicuniations lol like being high on diphenhydramine
heres some lolis
|
hey guise i'm not an advanced programmer or anything but i'm convinced my lab partner is a moron
![[image loading]](http://i.imgur.com/zAr3t8a.png)
what can i do to stop him from doing dumb stuff like this
|
I was most successful by drawing what's happening on paper with a pencil, boxes with names and arrows and stuff like that. I mean that as an addition to trying to explain normally with words.
|
|
|
|