|
Has anyone here used Visual Studio Lightswitch? I'm not really much of a programmer, but deal with a lot of shoddy apps built using MS Access / SQL Server, and this looks like a pretty neat and easy way to build applications...
|
# ? Nov 1, 2011 19:32 |
|
|
# ? May 15, 2024 01:24 |
|
shrughes posted:In average case scenarios or worst case scenarios? In worst case scenarios, the OS scheduler can be very important. Can you elaborate on common scenarios where differences in the way the OS schedules/manages memory can greatly affect the speed at which something executes given the hardware and physical memory is the same?
|
# ? Nov 1, 2011 20:13 |
|
This is a very stupid Python question. I haven't done any programming in years and I'm trying to teach myself Python by making up a task and completing with Google and documentation but I've hit a stupid wall that makes me feel very dumb. I've been able to scrape a webpage and put the elements I need into a list of 1500 or so strings that I'm trying to put into a csv file so I can import and manipulate it. I need to write 4 of those strings, the first 3 with a '\t' delimiter and then a '\n' after the fourth. I keep trying different loops but I keep getting the wrong results. What stupid thing am I missing?
|
# ? Nov 1, 2011 20:35 |
|
Ariza posted:I've been able to scrape a webpage and put the elements I need into a list of 1500 or so strings that I'm trying to put into a csv file so I can import and manipulate it. I need to write 4 of those strings, the first 3 with a '\t' delimiter and then a '\n' after the fourth. I keep trying different loops but I keep getting the wrong results. What stupid thing am I missing? You're missing posting your code so we can see what you're missing. And you're probably going about parsing a webpage in a very, very wrong fashion. What are you using to parse the syntax?
|
# ? Nov 1, 2011 20:39 |
|
baquerd posted:You're missing posting your code so we can see what you're missing. And you're probably going about parsing a webpage in a very, very wrong fashion. What are you using to parse the syntax? I'm using Beautifulsoup to parse the webpage. The syntax isn't the issue at all as I'm getting everything I need, parsed in the way I need it other than the missing new line after every fourth entry, and put into a list (I think it's a list anyways) or just straight written into a text file. code:
|
# ? Nov 1, 2011 20:58 |
|
Ariza posted:I'm using Beautifulsoup to parse the webpage. The syntax isn't the issue at all as I'm getting everything I need, parsed in the way I need it other than the missing new line after every fourth entry, and put into a list (I think it's a list anyways) or just straight written into a text file. Ah, OK. What you're looking to do can of course be solved in a variety of ways. The first that comes to mind is using a counter: code:
|
# ? Nov 1, 2011 21:12 |
|
baquerd posted:Ah, OK. What you're looking to do can of course be solved in a variety of ways. The first that comes to mind is using a counter: Thanks so much! I completely forgot about if statements and was trying to use nested for statements which I am way too dumb to use effectively. I used that and it worked perfectly. Now I can pull down tons of data to mess with.
|
# ? Nov 1, 2011 21:36 |
|
baquerd posted:Ah, OK. What you're looking to do can of course be solved in a variety of ways. there is more than one way to do it ? code:
code:
code:
|
# ? Nov 1, 2011 21:51 |
|
Ariza posted:This is a very stupid Python question. I haven't done any programming in years and I'm trying to teach myself Python by making up a task and completing with Google and documentation but I've hit a stupid wall that makes me feel very dumb. Ariza posted:I completely forgot about if statements
|
# ? Nov 1, 2011 22:19 |
|
tef posted:
And that's why you don't provide more than one way to do things
|
# ? Nov 1, 2011 22:57 |
|
I love how, when it comes to these coding questions, you'll probably get a few good solutions and then one guy who does it completely wrong. Not because he is dumb, but because he is an entertaining jerk.
|
# ? Nov 2, 2011 05:42 |
|
The production of code:
Barring heredoc shenanigans, I'll set par at 85 bytes. How low can you go? Blotto Skorzany fucked around with this message at 07:20 on Nov 2, 2011 |
# ? Nov 2, 2011 07:18 |
|
Welp, not gonna beat 85 bytes, but here's a 101 byte solution in Forth:code:
code:
And if I rewrite it to work in GForth rather than my own dialect, code:
Internet Janitor fucked around with this message at 14:10 on Nov 2, 2011 |
# ? Nov 2, 2011 13:52 |
|
code:
code:
|
# ? Nov 2, 2011 14:25 |
|
import List "aA1w">>=(++"\n").intersperse '\t'.take 4.iterate succ
|
# ? Nov 2, 2011 14:52 |
|
code:
code:
|
# ? Nov 2, 2011 15:04 |
|
yaoi prophet posted:which is 82. if your input data is a list of strings rather than a flattened list, it is much shorter in python code:
|
# ? Nov 2, 2011 15:07 |
|
Otto Skorzeny posted:Barring heredoc shenanigans, I'll set par at 85 bytes. How low can you go? actually shall we start a thread? as much as I enjoy diverting a megathread now and then it looks like this deserves its own thread
|
# ? Nov 2, 2011 15:11 |
|
*perl*code:
code:
code:
code:
code:
shrughes fucked around with this message at 18:38 on Nov 2, 2011 |
# ? Nov 2, 2011 18:22 |
|
Maybe someone can post a solution in J?
|
# ? Nov 2, 2011 18:54 |
|
The output is 31 characters. No-one seems to be anywhere near that yet.
|
# ? Nov 2, 2011 19:13 |
|
Zombywuf posted:The output is 31 characters. No-one seems to be anywhere near that yet.
|
# ? Nov 2, 2011 19:58 |
|
Zombywuf posted:The output is 31 characters. No-one seems to be anywhere near that yet. PHP: code:
|
# ? Nov 2, 2011 20:06 |
|
Ariza posted:Thanks so much! I completely forgot about if statements and was trying to use nested for statements which I am way too dumb to use effectively. I used that and it worked perfectly. Now I can pull down tons of data to mess with. You're writing a (dialect of a) CSV file, so use the CSV module qntm posted:PHP: hah nice edit: unless you count the HTTP headers :\ Munkeymon fucked around with this message at 21:00 on Nov 2, 2011 |
# ? Nov 2, 2011 20:53 |
|
qntm posted:PHP: Now make it smaller than 31 bytes
|
# ? Nov 2, 2011 21:03 |
|
Going back to topic, I've been asked to do some basic image manipulation. All I really need to do is pull individual pixels or regions from jpeg image, do various calculations on their RGB/greyscale values and then produce new images. I'd ideally prefer to do this in Haskell because I'm a special functional snowflake academic but the Data.Bitmap library doesn't really seem like it does what I want it to do. The is also a binding to the DevIL library which seems much better. Has anybody has any experience with this sort of thing? Failing that I'll probably do it in Java, is the Image2D library any good? I guess I'm looking for recommendations of libraries/good tutorials (preferably in Haskell of course)
|
# ? Nov 2, 2011 21:52 |
|
So this is something a 5th grader could probably figure out so sorry for the dumb question... I work for a small vacation apartment rental company and we spend a crazy amount of time giving people rental quotes and booking instructions over email. Nothing is automated so we have to do like 5 things to answer each email. There has got to be a simple way to make this whole process easier. Here is our process: The guests email us asking if we have vacancy during their requested dates. We put the dates into our database to see if the apartment is available. If it is available we open an excel spreadsheet that shows the rates. We then find the rate for their booking. We have 14 separate pre-written emails (one for each apartment) that contain information for booking the apartment. So we copy & paste the text into a new email. Then we go through the email "template" and manually replace the information like their name, the rental date, the total days of the rental and the price of the rental. Sometimes they request multiple properties so we have to manually add up the rental price for each property they request and it takes forever. Then we send the email. ----- Is there a program (excel or something) that will allow me to simply enter the client's name and travel dates and it and populates an email with the price and all the other information? The email would look something like this (the bold parts are what would be populated): Hello Jim, Thank you for contacting XZY rentals. The Goon Virgin Chamber and the WOW Gamers Heaven apartments you've requested are available for your dates of 1 December - 8 December (7 nights). The total rental price for Goon Virgin Chamber is $1000. This price includes all taxes and fees. To reserve you're dates you must pay a deposit of $500 (50% of the rental fee). The total rental price for WOW Gamers Heaven is $1200. This price includes all taxes and fees. To reserve you're dates you must pay a deposit of $600 (50% of the rental fee). Etc... This would save me an hour or two on slow days and 4+ hours on busy days. Im not looking for anything fancy but spending half my day doing boring copy & paste is getting really lame.
|
# ? Nov 2, 2011 21:59 |
Omits-Bagels posted:stuff about form emails Not entirely sure, I haven't looked at it for ages, but maybe Word mail merge can be coaxed to do this. Edit: The article I linked is for Word 2003, here's something for 2007. I imagine you could make it work by having an Excel sheet where you fill in the relevant data, you may be able to add some calculations to do menial lookups as well, and use that as data source for the merge. nielsm fucked around with this message at 22:08 on Nov 2, 2011 |
|
# ? Nov 2, 2011 22:04 |
|
Since you mentioned Excel, you could do it with Word's form letter / mail merge functionality: http://support.microsoft.com/kb/294683/en
|
# ? Nov 2, 2011 22:05 |
|
nielsm posted:Not entirely sure, I haven't looked at it for ages, but maybe Word mail merge can be coaxed to do this. How much would it cost to get someone to set this up for me?
|
# ? Nov 2, 2011 23:22 |
|
Omits-Bagels posted:How much would it cost to get someone to set this up for me? It'd probably be a couple of hours depending on how complex the cases for your 14 emails are. The real stumbling block is going to be extracting the dates/location out of the original email. If you go down this road though, I strongly suggest you inhouse it (e.g. have someone in your organization learn it) because mail merge is finicky as hell, so if it breaks suddenly you're screwed and there's no one around who knows how to fix it. That and it's not that hard to learn up on yourself. Just speaking out of my rear end, but what sounds like a better solution might be a web site where they can plug in dates/choose from location, click submit, it hits a database to get answers, and then just shows them their requested info with an option to book immediately.
|
# ? Nov 3, 2011 01:05 |
|
I've got a weird segmentation fault that occurs when a 2D vector I've created goes out of scope. For some example code:code:
Edit: Nevermind, I tried on a different compiler, and it worked fine. It looks like my library has a problem. downout fucked around with this message at 05:29 on Nov 4, 2011 |
# ? Nov 4, 2011 05:08 |
|
I'm having difficulty using gcc to link object files compiled from C source using gcc to object files assembled by yasm. I'm on RHEL on a 64 bit machine, though the asm was originally written on windows for a 32 bit machine. I'm using the yasm flags "-f elf -m amd64". No porting has been done on the asm, but I can confirm it works on windows. When I attempt to link the files, I get a whole mess of "undefined reference" errors. yasm outputs no errors during assembly, and nm shows that the object files produced by yasm do contain references to the stuff I need. Is there something special I need to do to get yasm object files to link to gcc object files? e: HAH. solved it. needed -elf64 TasteMyHouse fucked around with this message at 16:14 on Nov 4, 2011 |
# ? Nov 4, 2011 15:28 |
|
I'm generating a bunch of shell commands in python and I want to start running them in parallel with a concurrent limit equal to some factor of the local cpu count. How should I go about doing this? Right now I'm just using subprocess.call() on each of the commands which runs them sequentially. edit: I think I need to use this multiprocessing.Pool Shaocaholica fucked around with this message at 18:04 on Nov 4, 2011 |
# ? Nov 4, 2011 17:48 |
|
Shaocaholica posted:I'm generating a bunch of shell commands in python and I want to start running them in parallel with a concurrent limit equal to some factor of the local cpu count. How should I go about doing this? Right now I'm just using subprocess.call() on each of the commands which runs them sequentially. I had to do something similar a while ago but being lazy and under a deadline, I just modified the calls so they called at. Like code:
|
# ? Nov 4, 2011 17:58 |
|
Otto Skorzeny posted:It doesn't always return NULL when it can't actually allocate the amount of memory you requested.
|
# ? Nov 4, 2011 21:15 |
|
I'd like to get back into my programming as a hobbyist thing, and hell, maybe even go back to school for it if I get into it well enough. Is there a good resource out there for simple practice programs? I can read the books well enough, but the one thing I'm missing from when I took CS classes is the occasional "apply what you've learned to write a program to do x" assignment.
|
# ? Nov 6, 2011 01:28 |
|
Meldonox posted:I'd like to get back into my programming as a hobbyist thing, and hell, maybe even go back to school for it if I get into it well enough. Is there a good resource out there for simple practice programs? I can read the books well enough, but the one thing I'm missing from when I took CS classes is the occasional "apply what you've learned to write a program to do x" assignment. If you're up for a bit of math to mix in with your programming, Project Euler has a list of things to work on.
|
# ? Nov 6, 2011 01:35 |
|
PDP-1 posted:If you're up for a bit of math to mix in with your programming, Project Euler has a list of things to work on. Project Euler has always struck me as a bit of programming to mix in with your math rather than the other way around. Some of the early problems are good, but the later ones can get pretty esoteric.
|
# ? Nov 6, 2011 02:13 |
|
|
# ? May 15, 2024 01:24 |
|
This is something that I've never found a nice solution to over the years, so I'm not expecting much, but here goes: Has anyone ever found a nice OO way of wrapping/lifting a bidirectional graph/hierarchy of objects into another bidirectional graph/hierarchy? Let's say you store in the database relationships from type A to type B. Two tables in SQL. Easy. But in code you want to make further distinctions. Some As are actually A1s, others A2s etc. which implies the corresponding Bs are B1s, B2s etc. You can do this sort of thing in OO, and graphs that just go one way are fine, but with two-ways it gets messy and error prone ensuring your A1s points to your B1s and vice versa. Another example would be wrapping the Excel PIA objects like Workbook, Worksheet, Range into MyWorkbook, MyWorksheet, MyRange (there can be good reasons for doing this sort of thing e.g. being able to re-use the same code for PIAs and newer Excel libraries which query the Xml instead but have less functionality). For the purposes of the discussion, let's ignore ORMs that support inheritance with table per subtype.
|
# ? Nov 6, 2011 02:55 |