|
I want to limit my daily 'loving around on the internet' internet access, on a mac (my work laptop) I know how to just block off websites by editing /etc/hosts, but how about something like a time based filter, so I *can* read some news site for 15 minutes a day but no more? Or something that delays all clicks on a website by 30 seconds (as the xkcd guy mentioned once?) If there's a program I'll just download it. If I have to write some sort of script can someone give me a starting point or tell me what to look up? I don't know much about web-related coding, I'm a back-end dev.
|
# ? Jan 26, 2012 10:54 |
|
|
# ? May 16, 2024 01:16 |
|
redreader posted:I want to limit my daily 'loving around on the internet' internet access, on a mac (my work laptop) This question is more frequently answered in SH/SC.
|
# ? Jan 26, 2012 14:11 |
|
I have an app in which the user can drag objects around and resize them with the mouse. I don't want the objects to overlap each other/the edge of the window. All objects are rectangles. Currently I have this (in a mouseDragged method called continually by the OS):code:
I can't control the rate of mouse updates, so is there an algorithm for "fitting up" against the edge/object? I tried doing the rect construction in a while (!isValid) loop and then having the deltas limit towards 0, but that created weird sideeffects when nearing a corner of another object. Any algorithms for this?
|
# ? Jan 26, 2012 20:06 |
|
Carthag posted:I have an app in which the user can drag objects around and resize them with the mouse. I don't want the objects to overlap each other/the edge of the window. All objects are rectangles. Currently I have this (in a mouseDragged method called continually by the OS): You could just make it always move but instead of just x = mouseX you could do x = min(max(mouseX, screen_width), 0) (but of course factoring your rectangle into that)
|
# ? Jan 27, 2012 03:11 |
|
Jewel posted:You could just make it always move but instead of just x = mouseX you could do x = min(max(mouseX, screen_width), 0) (but of course factoring your rectangle into that) Hmm, maybe. It'll at least fix the case of going near the edge of the window. It'll be a bit harder to fix the other case, cause there can be multiple objects all laying around, and I don't want to overlap any of them. Also I just realized I posted the wrong part of my check; here's where the goodies are: code:
|
# ? Jan 27, 2012 15:08 |
|
Back in the nineties, I've got fond memories of loading up my hex editors and other script kiddie tools and hacking in shortcuts to my Mac OS 9 application menus. What's the modern method of adding hotkeys to my XP or windows 7 application file/edit/view menus?
|
# ? Jan 27, 2012 19:49 |
|
ante posted:Back in the nineties, I've got fond memories of loading up my hex editors and other script kiddie tools and hacking in shortcuts to my Mac OS 9 application menus. I dunno about Windows, but on Mac OS X it's in System Preferences under Keyboard - you can add shortcuts for any app/menu you feel like there. Not being a platform warrior, just putting that out there in case a current Mac user wants to know. Also ResEdit was such a fun app for a budding nerd.
|
# ? Jan 27, 2012 20:14 |
|
Suppose we have n series of data points, for which each series can be graphed as a line. On this graph, a mouse pointer moves and in real time I need to detect whether the pointer is on top of a line. I have the happy constraint that across all series the x-axis coordinates are shared. That is to say that for any x-value for which I have data, all series will have such a data point. This can be accomplished in O(n) by taking a first pass through any series to find the upper and lower x-axis values for the data points around the mouse pointer, then a second pass through each series to interpolate the y value of each series at the x-value of the pointer and selecting the closest one (you could get a better fit in O(n) with a third pass to ferret out the edge case with an extremely steep slope that would result closer line to the pointer but this is a good enough fit). This can be accomplished in O(1) by segmenting the graph into individual pixels (or small boxes), and pre-calculating either a particular series or the absence of any series in each spot. Precalculating is O(n) for any particular pixel using the live O(n) algorithm, and if the graph is segmented into, for example a 200x200 grid, this process is repeated 40,000 times. Each pass can in reality be made much quicker by filtering out series with data points that would result in a pointless interpolation, but this is still a fair amount of processing for large values of n. Does anyone have any suggestions for other avenues of pursuit?
|
# ? Jan 28, 2012 00:36 |
|
baquerd posted:Suppose we have n series of data points, for which each series can be graphed as a line. On this graph, a mouse pointer moves and in real time I need to detect whether the pointer is on top of a line. I have the happy constraint that across all series the x-axis coordinates are shared. That is to say that for any x-value for which I have data, all series will have such a data point. Just sort the data by x coordinate (if it isn't already) then do a binary search rather than a linear search?
|
# ? Jan 28, 2012 00:44 |
|
Plorkyeran posted:Just sort the data by x coordinate (if it isn't already) then do a binary search rather than a linear search? Sure, but finding the x-coordinate bounds isn't computationally expensive at all as only a single series data points needs to be looked at. The y-coordinates have to be interpolated (or at least the lower and upper bound checked for each series with the series falling within the bounds having their y-values interpolated), so that's O(n) to get those anyway.
|
# ? Jan 28, 2012 00:47 |
|
Oh, I misread that as n data points, not n series. Are you actually looking at drawing enough series on a single graph that interpolating between two points for each of them is even vaguely a concern? That sounds like a usability nightmare even if it is fast enough. I suppose if it's a massive graph that's pan and zoomable you might be able to get there. One idea would be to use a quadtree rather than a grid of fixed size boxes for precomputing which series are potentially near each pixel.
|
# ? Jan 28, 2012 01:01 |
baquerd posted:This can be accomplished in O(1) by segmenting the graph into individual pixels (or small boxes), and pre-calculating either a particular series or the absence of any series in each spot. Precalculating is O(n) for any particular pixel using the live O(n) algorithm, and if the graph is segmented into, for example a 200x200 grid, this process is repeated 40,000 times. Each pass can in reality be made much quicker by filtering out series with data points that would result in a pointless interpolation, but this is still a fair amount of processing for large values of n. It's not repeated 40,000 times, you only have to do it N*(Xmax-Xmin) times. Start with an array Xmax-Xmin long, each element of which is an array Ymax-Ymin long. For each X, interpolate each member of N, and fill in array[x][y] with a true or or a reference if you need a line reference. That gets you your O(1) in many fewer computations, since you can just assume (probably correctly) that the vast majority of the boxes are going to be empty/false, and thus default them to the correct value. See also: sparse matrices.
|
|
# ? Jan 28, 2012 01:10 |
|
Plorkyeran posted:Oh, I misread that as n data points, not n series. Are you actually looking at drawing enough series on a single graph that interpolating between two points for each of them is even vaguely a concern? That sounds like a usability nightmare even if it is fast enough. I suppose if it's a massive graph that's pan and zoomable you might be able to get there. Yes, for example 400 series each with 2000 data points would not be the worst case scenario by far (2 variables on separate axes with 5 years of daily financial data over 200 instruments). It's totally zoomable and pannable, and the mouseover on line functionality shows an annotation with the data over the pointer. I have "acceptable" performance for that size dataset at the moment, but it could be snappier and it would be nice to support even larger datasets. NinjaDebugger posted:It's not repeated 40,000 times, you only have to do it N*(Xmax-Xmin) times. Good point, and though I need to support values between the x values of the dataset, that's not quite as fine as Xmax-Xmin on my scale so it's even better. Plorkyeran posted:One idea would be to use a quadtree rather than a grid of fixed size boxes for precomputing which series are potentially near each pixel. Veeeery interesting. Here's what I think I'm going to implement: Precalculated line quadtree with a small bucket capacity (potentially one). Beneath a certain size threshold, additional lines will be discarded. Lookup of pointer to quadtree series bucket in real-time is baquerd fucked around with this message at 02:28 on Jan 28, 2012 |
# ? Jan 28, 2012 02:06 |
|
ante posted:Back in the nineties, I've got fond memories of loading up my hex editors and other script kiddie tools and hacking in shortcuts to my Mac OS 9 application menus. Use auto-it or autohotkey, it's loving amazing at adding shortcuts to things that don't have shortcuts. Anotehr habit I've picked up is using greasemonkey to modify shortcuts on websites - I wrote a greasemonkey plugin that makes it so if I press left/right arrow, it goes back and forward in a thread (except if I'm typing a reply) by figuring out that there's a link called "next" or "prev" on the page and binding it to left and right unless there's an edit text box on the page. It's actually pretty ludicrously complex now, but here's an excerpt (I have keys for going up forums, smooth scrolling through posts, etc) code:
|
# ? Jan 28, 2012 04:09 |
|
I am looking into writing apps for smart phones, but I'd like to have just one code base, and a separate compile for iOs/iphone, Android, Windows Phone, etc? I.e., I don't want to write one code base for iOs in objective C, another in Java for Android, and another in C# for Windows Phone, etc... I recall reading somewhere that C# compiled with Mono, instead of .NET, can be ported to iOs, Android, and Windows Phone. But, that is just one thing I read... What do you recommend as a good way to keep one code base and code apps that can be compiled for iOs, Android, etc? Are there drawbacks to doing it this way? If so, what?
|
# ? Jan 29, 2012 07:33 |
|
cannibustacap posted:I am looking into writing apps for smart phones, but I'd like to have just one code base, and a separate compile for iOs/iphone, Android, Windows Phone, etc? PhoneGap may help you here.
|
# ? Jan 29, 2012 07:58 |
|
i barely GNU her! posted:PhoneGap may help you here. I surfed around and found PhoneGap and also Rhomobile... Are those the standard way of doing things? Their web pages don't mention using C# or Java as the code base, they just seem to talk about the code base as a generality... EDIT: It seems like PhoneGap and Rhomobile is based on HTML, not Java/C#.. cannibustacap fucked around with this message at 08:08 on Jan 29, 2012 |
# ? Jan 29, 2012 08:01 |
|
cannibustacap posted:I am looking into writing apps for smart phones, but I'd like to have just one code base, and a separate compile for iOs/iphone, Android, Windows Phone, etc? Fake Edit; phonegap and rhomobile are really kinda awful, and I don't think they'll let you deploy anything to WM7 because of the XNA requirement. Real Edit; I guess phonegap can deploy to WM7 now, though it's not entirely production ready (apparently). It's changed a bit since I last used it (2009?) so anything I've said previously can safely be ignored until you've tried it for yourself! The Gripper fucked around with this message at 08:17 on Jan 29, 2012 |
# ? Jan 29, 2012 08:12 |
|
The Gripper posted:I've *heard* good things about MonoTouch/Mono for Android, but haven't personally used either of them. It'll definitely let you reuse a lot of code between Android and iOS (though I believe you'll need to rewrite a lot of API accessing parts for each), but for Windows Mobile you'll still need to have a separate XNA oriented project (with entirely different interface/API code). At least it's still .NET though, so if you can properly separate interface/api code from other logic it may be possible to copy and paste parts of it. I noticed there is Mono for android: http://xamarin.com/monoforandroid Then Mono for iOS: http://xamarin.com/monotouch They almost seem like separate things, and you need the pro version, $399, to make use of them. I'm confused though... Are those two separate IDE's that I need to use? That makes me think there will be more than one code base. I'd like there to be just 1 single IDE. I will write wrapper functions to handle the iOs and Android specific functions, and separate simulator windows for each type of phone I am writing for. Will Mono do that? I don't mind paying $399, if it can do that, it is totally worth it.
|
# ? Jan 29, 2012 08:29 |
|
I'm a developer who has been at the same job for 9 years. This year I've been given a training budget to do whatever the hell I want with. The only problem is that I use pretty static technologies in my day to day work so I don't know what to do with it. Does anyone know any good resources for finding training topics/classes? I know I would love to learn some new things but I don't even know where to start. All my google-fu has led me to some pretty sketchy looking courses or stuff that looks way to introductory. Any ideas? I'd be happy to just find a blog or blogs that said hey, I took this course and I dug it. I must just suck at google.
|
# ? Jan 30, 2012 22:56 |
|
idolmind86 posted:I'm a developer who has been at the same job for 9 years. This year I've been given a training budget to do whatever the hell I want with. The only problem is that I use pretty static technologies in my day to day work so I don't know what to do with it. Do you have a particular direction in mind? Most of the worthwhile courses are tied a certification, so for example if your job involves networking a lot of people go for the Cisco path (CCNA). If you're doing Microsoft programming there's the MCS* courses as well. Those are just two off the top of my head, but there are also database management courses as well. What would help is knowing more about the area you're working in.
|
# ? Jan 31, 2012 00:17 |
|
Carthag posted:I dunno about Windows, but on Mac OS X it's in System Preferences under Keyboard - you can add shortcuts for any app/menu you feel like there. Not being a platform warrior, just putting that out there in case a current Mac user wants to know. Yeah, ResEdit kicked rear end. I need a fairly professional looking solution, so I've got the application I need to modify open in Ollydbg to try and send a command whenever I hit F9. It's been like, a year since I've done any serious disassembling, so we'll see what I can figure out.
|
# ? Jan 31, 2012 02:06 |
|
Scaramouche posted:Do you have a particular direction in mind? Most of the worthwhile courses are tied a certification, so for example if your job involves networking a lot of people go for the Cisco path (CCNA). If you're doing Microsoft programming there's the MCS* courses as well. Those are just two off the top of my head, but there are also database management courses as well. What would help is knowing more about the area you're working in. Well, currently my job doesn't really rely too much (or care about) certifications. And I don't see myself going anywhere in the immediate future that would. I've gotten Oracle certifcations (OCM) out the wazoo and honestly they don't help me in my professional life at all. A lot of our products are UNIX using c/c++ (mostly c). Recently we do more in java. We also do a lot with Oracle as well. My first thought was trying to find some super advanced java programming course that would blow my mind but I haven't really been able to find anything like that. Honestly, I think what I enjoy the most would be taking a graduate class a semester, just for fun and strengthening my brain but my job doesn't want me to pursue an advanced degree as they fear it will interfere with my work. I have one of those jobs where I'm expected to drop anything/everything if need be, although I am compensated thusly.
|
# ? Jan 31, 2012 14:28 |
|
I have no idea what thread to put this into, I couldn't find a *nix one. Anyways, I remember back in the day when I could type this at the Linux prompt: set path1 = `pwd` and then be able to echo or cd to $path1 no matter where I was. This was useful for areas I was temporarily concerned with, but didn't warrant something like a symbolic link/setting something in my home profile. Anyways, this no longer works. Am I not remembering this correctly? I'm in the korn shell, if that matters.
|
# ? Jan 31, 2012 20:34 |
|
Lose the "set" and the spaces and it should work.
|
# ? Jan 31, 2012 21:30 |
|
idolmind86 posted:Well, currently my job doesn't really rely too much (or care about) certifications. And I don't see myself going anywhere in the immediate future that would. I've gotten Oracle certifcations (OCM) out the wazoo and honestly they don't help me in my professional life at all. Unfortunately I don't think there's a lot that can be done generically then; it sounds like you're going to have to look at local colleges/professional groups and see what they have on offer. You might have some luck looking up if there's a local Unix User's group or something, maybe?
|
# ? Jan 31, 2012 22:47 |
|
mister_gosh posted:I have no idea what thread to put this into, I couldn't find a *nix one. I don't use ksh but maybe it has pushd and popd?
|
# ? Feb 1, 2012 07:19 |
|
So, two stupid things I'd like to learn how to do. Honestly, at this point, I'd like to know if they're even possible. I can (hopefully) figure out the actual mechanics. I've only ever had experience scripting with batch files, so for now, I'd like to just use those. If not, hey, always good to learn something new, right? 1) Is there a way to specify a file by the Date Modified column? I basically want to have a script that auto-deletes the oldest file in a certain folder when I run it. 2) How do you check to see if a program is already running? I'm trying to write a script that checks to see if a couple different programs are running, and if not, to start them. Like I said, I've only ever used simple batch files. If it can't be done with those, oh well. Guess I'd better learn some languages, hahaha. Thanks in advance, goons.
|
# ? Feb 1, 2012 15:25 |
|
I'm pretty sure that's possible even with just the batch files, you can get a list of processes with tasklist and compare it to your programs, same with the modification time and dir (keep track of the oldest file's name and delete it once you checked every file). As to how exactly this can be done, you probably know better than I do as the last time I did any batch programming was in the DOS/Win9x time.
|
# ? Feb 1, 2012 17:09 |
|
My officemate asked if you can write a program to detect an infinite loop in code. I said that from what I remember from my ECE days, certain compilers will detect an infinite loop. He seem unconvinced.
|
# ? Feb 1, 2012 23:01 |
|
Josh Lyman posted:My officemate asked if you can write a program to detect an infinite loop in code. I said that from what I remember from my ECE days, certain compilers will detect an infinite loop. He seem unconvinced. In general, this isn't possible (see the Halting Problem). Some languages can detect some kinds of infinite loops (GHC's <<loop>> for example). edit: Agda can apparently do something like this, but then it's not Turing complete. gonadic io fucked around with this message at 23:37 on Feb 1, 2012 |
# ? Feb 1, 2012 23:13 |
|
Josh Lyman posted:My officemate asked if you can write a program to detect an infinite loop in code. I said that from what I remember from my ECE days, certain compilers will detect an infinite loop. He seem unconvinced. You can detect some of them, but being able to detect any infinite loop would be solving the Halting Problem which is provably impossible e:f;b
|
# ? Feb 1, 2012 23:15 |
|
Walter_Sobchak posted:So, two stupid things I'd like to learn how to do. Honestly, at this point, I'd like to know if they're even possible. I can (hopefully) figure out the actual mechanics. I've only ever had experience scripting with batch files, so for now, I'd like to just use those. If not, hey, always good to learn something new, right? Are you doing Windows batch commands or unix style scripting? If its Unix command line scripting you can just do something like ls -rlta . | grep -i ^- | head -n 1 | cut -d ' ' -f 12 | xargs echo "this is the oldest file: "
|
# ? Feb 1, 2012 23:28 |
|
Yeah, there are some simple conditions under which the compiler can be highly confident that an infinite loop will occur (say, an expression that reduces to while(a || !a)) and be justified in throwing a warning but in the general case there cannot be a perfect detector written.
|
# ? Feb 1, 2012 23:34 |
|
Walter_Sobchak posted:So, two stupid things I'd like to learn how to do. Honestly, at this point, I'd like to know if they're even possible. I can (hopefully) figure out the actual mechanics. I've only ever had experience scripting with batch files, so for now, I'd like to just use those. If not, hey, always good to learn something new, right? If you have it Powershell could do it. There's a dedicated thread in this forum too.
|
# ? Feb 1, 2012 23:47 |
|
I have a problem with dynamic languages that really slows down my workflow. In a language like Python or Javascript where I have to interact with another library/API (i.e. like feedreader in Python or jQuery) sometimes I have trouble figuring out how to interact with the object returned from a method that I did not write. For the most part, reading documentation usually helps somewhat but sometimes it's not always clear to me how I can interact with objects from external libraries. What ways do you guys use to find out more about these objects?
|
# ? Feb 2, 2012 01:25 |
|
Puddy1 posted:I have a problem with dynamic languages that really slows down my workflow. In a language like Python or Javascript where I have to interact with another library/API (i.e. like feedreader in Python or jQuery) sometimes I have trouble figuring out how to interact with the object returned from a method that I did not write. For the most part, reading documentation usually helps somewhat but sometimes it's not always clear to me how I can interact with objects from external libraries. What ways do you guys use to find out more about these objects?
|
# ? Feb 2, 2012 02:12 |
|
Anyone have any favorite hex editors? I want to take a look at some game data files as a little challenge for myself and want to know if anyone has a hex editor they really love. Windows freeware, preferably
|
# ? Feb 2, 2012 08:57 |
|
I've had good results with HxD. That (along with brainpower and lots of wrong guesses) is how I reverse engineered the VFS file format used in Cargo! The Quest for Gravity
Suspicious Dish fucked around with this message at 09:18 on Feb 2, 2012 |
# ? Feb 2, 2012 09:15 |
|
|
# ? May 16, 2024 01:16 |
|
redleader posted:Anyone have any favorite hex editors? I want to take a look at some game data files as a little challenge for myself and want to know if anyone has a hex editor they really love. Windows freeware, preferably For a commercial package, SweetScape 010 editor is hard to beat and particularly good for game data/save game things. Has a built-in c-like templating language that lets you define the format of your file and highlight/separate regions, structs and values.
|
# ? Feb 2, 2012 09:19 |