Search Results

Search found 167 results on 7 pages for 'earlz'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Casting functions -- Is it a code smell?

    - by Earlz
    I recently began to start using functions to make casting easier on my fingers for one instance I had something like this ((Dictionary<string,string>)value).Add(foo); and converted it to a tiny little helper function so I can do this ToDictionary(value).Add(foo); Is this a code smell? (also I've marked this language agnostic even though my example is C#)

    Read the article

  • Helper Casting Functions -- Is it a code smell?

    - by Earlz
    I recently began to start using functions to make casting easier on my fingers for one instance I had something like this ((Dictionary<string,string>)value).Add(foo); and converted it to a tiny little helper function so I can do this ToDictionary(value).Add(foo); Is this a code smell? Also, what about simpler examples? For example in my scripting engine I've considered making things like this ((StringVariable)arg).Value="foo"; be ToStringVar(arg).Value="foo"; I really just dislike how inorder to cast a value and instantly get a property from it you must enclose it in double parentheses. I have a feeling the last one is much worse than the first one though (also I've marked this language agnostic even though my example is C#)

    Read the article

  • Hidden features of x86 assembly

    - by Earlz
    I am still a fan of x86 assembly(sorta) and know a lot of developers still using x86 assembly, although by far there are very few features available in assembly, let us list out the most useful and not so well known ones. Of course the question is on the lines of the Hidden Features questions listed below.: Hidden Features of JavaScript Hidden Features of CSS Hidden Features of C# Hidden Features of VB.NET Hidden Features of Java Hidden Features of ASP.NET Hidden Features of Python Hidden Features of TextPad Hidden Features of Eclipse Hidden Features of Classic ASP Please specify one feature per answer. Also, you can specify all bits of the x86 such as 16bit(real mode), 32bit, and 64bit. Please keep it neutral of assembler though. Both Intel and AT&T syntax is welcome but please don't for example demonstrate a useful macro feature for yasm.

    Read the article

  • CheckboxList to display aligned?

    - by Earlz
    Hello, I made a CheckboxList and it will not line up. I don't see any way to control the generated HTML. Right now, the check boxes do not align due to the widths of the <td> of each checkbox label being an automatic width. How can I set the width of this and make all the labels and checkboxes appear in two vertical aligned columns? My code is simple: <div style="text-align: center;"> <p> Here you will tell.. </p> <asp:CheckBoxList runat="server" ID="cbl" Width="300px"></asp:CheckBoxList> <br /> <input type="button" id="next_3" value="Next Page" /> </div> And here is a screen shot

    Read the article

  • Is it good or bad practice to use var everywhere? [closed]

    - by Earlz
    Possible Duplicate: Use of var keyword in C# Hello, I've recently been discovering the awesomeness that is the var keyword in C#. Well, I didn't think about it before but I just wrote lines of code that are along the lines of var con=CreateNewConnection(); Where this would usually be IdbConnection con=CreateNewConnection(); Is this a good use of var? Is it possible to use var too often? Are there any downsides to using it? Also, one more point of consideration: We are not worried about backwards compatability. We just care that it runs on .NET 3.5

    Read the article

  • Sharing a custom datasource between Winforms and Webforms

    - by Earlz
    Hello, I'd like to create a custom datasource that is shared between a Winforms and Webforms project. This functions as a middle layer for a reporting tool(DevExpress Reporting). The Webforms project is a designer for these reports. So we want for the reports to be capable of going to the server to get data and such. So our datasource would abstract away all the communication overhead. Then, for consistency, the datasource would also run on the server for reporting, except for their would be no communication. What would be the best course of action? There doesn't seem to be such a thing as a DataSource in Winforms. Is DataSource not the thing I'm looking for? Edit: After some research, it appears that IDataAdapter may be good for my purpose. Any opinion on that?

    Read the article

  • How to do REST securely and with sensitive data?

    - by Earlz
    Hello, we are implementing a new web service. The web service will be a store of sensitive data and there are multiple users types with different permissions. So some user types can't access(and some can't change, and so on) certain types of data. How would this work in REST? I'm very new to REST, so sorry if this sounds noobish.

    Read the article

  • CheckboxList not setting Selected with Viewstate

    - by Earlz
    I have a CheckboxList that seems to load and do everything right, except for when I do a postback, it will not have the Item.Selected property set. I have viewstate disabled for the entire page. I load it like so(inside Page_Load on every load): foreach (DataRow service in d.Tables[0].Rows) { cblServices.Items.Add(new ListItem((string)service["description"], service["id"].ToString())); } My markup is simple: <asp:CheckBoxList runat="server" ID="cblServices" Width="300px"></asp:CheckBoxList> and then, I use basically something like this(in a _Click serverside event for a button) foreach(ListItem item in cblServices.Items){ if(item.Selected){ MyLabel.Text+="selected: "+item.Value+item.Text; } } and MyLabel never has any text added to it. I can verify with the debugger that it does reach the _Click's foreach loop, but no item is ever selected. What could be the cause of this?

    Read the article

  • CheckboxList not setting Selected with Viewstate disabled

    - by Earlz
    I have a CheckboxList that seems to load and do everything right, except for when I do a postback, it will not have the Item.Selected property set. I have viewstate disabled for the entire page. I load it like so(inside Page_Load on every load): foreach (DataRow service in d.Tables[0].Rows) { cblServices.Items.Add(new ListItem((string)service["description"], service["id"].ToString())); } My markup is simple: <asp:CheckBoxList runat="server" ID="cblServices" Width="300px"></asp:CheckBoxList> and then, I use basically something like this(in a _Click serverside event for a button) foreach(ListItem item in cblServices.Items){ if(item.Selected){ MyLabel.Text+="selected: "+item.Value+item.Text; } } and MyLabel never has any text added to it. I can verify with the debugger that it does reach the _Click's foreach loop, but no item is ever selected. What could be the cause of this?

    Read the article

  • What are some of the practical cons to using ASMX webservices?

    - by Earlz
    Hello, at my workplace we are about to start a big project. My boss (a programmer, this is a startup) wishes to use ASMX webservices for this purpose. I do not want to start off a new program using deprecated technology and would like to show him this. I dislike WCF at this moment because it has such an extreme learning curve, but I'd rather learn it than use an unsupported technology. The problem I'm having is that I can not find any practical list of cons and downfalls when compared to WCF so that I can convince my boss to not use them. And saying "it's not as powerful" is not an adequate explanation. What exactly can it not do that we may need it to do for a webservice that is not meant to be shared externally? (as in, we don't support third-parties using our webservices unless they are using one of our clients. )

    Read the article

  • How would you make a blog with a TDD approach?

    - by Earlz
    I'm considering remaking my blog(currently in PHP, but <100 lines of non-layout code) in Ruby on Rails just for the fun of it. I want to make another project in Rails, but I should learn Rails(more than hello world) before I go to try to create a full project. Another thing I want to do while remaking my blog is to at least figure out what TDD is all about. So how would you go about taking a Test Driven approach to the creation of a blog? What tests would you write? How would you begin? Everytime I visualize writing a blog it'd end up needing a million tests for a single component to fully test it. How do I avoid writing too many tests? Also, I am making this community wiki because I intend for this to basically be made into a mini tutorial/knowledge base...

    Read the article

  • How to output binary data to a socket with Ruby

    - by Earlz
    Hello I have a very simple HTTP ruby server. I want it to simply server a PNG image. So I sent headers like image/png but I think that Ruby is converting the image data to a string first. Here is my relevant code webserver = TCPServer.new('127.0.0.1', 20001) while (session = webserver.accept) #.... file = File.open("tmp_testserve.png", "rb") contents = file.read file.close session.print @content session.close #.... Is this what is happening?

    Read the article

  • Tool to validate HTTP responses?

    - by Earlz
    Hello, I'm going to be messing with some stuff at the raw HTTP level during the next few days and I'd like to make sure I'm following the standard as close as possible. Are there any tools out there to validate the HTTP responses that my server puts out to make sure they conform to the specification?

    Read the article

  • Quantum Computing and Encryption Breaking

    - by Earlz
    Ok, I read a while back that Quantum Computers can break most types of hashing and encryption in use today in a very short amount of time(I believe it was mere minutes). How is it possible? I've tried reading articles about it but I get lost at the a quantum bit can be 1, 0, or something else. Can someone explain how this relates to cracking such algorithms in plain English without all the fancy maths?

    Read the article

  • Is there a less painful way to GetBytes for a buffer not starting at 0?

    - by Earlz
    I am having to deal with raw bites in a project and I need to basically do something like this byte[] ToBytes(){ byte[] buffer=new byte[somelength]; byte[] tmp=new byte[2]; tmp=BitConverter.GetBytes(SomeShort); buffer[0]=tmp[0]; buffer[1]=tmp[1]; tmp=BitConverter.GetBytes(SomeOtherShort); buffer[2]=tmp[0]; buffer[3]=tmp[1]; } I feel like this is so wrong yet I can't find any better way of doing it. Is there an easier way?

    Read the article

  • Why is the base() constructor not necessary?

    - by Earlz
    Hello, I have a class structure like abstract class Animal { public Animal(){ //init stuff.. } } class Cat : Animal { public Cat(bool is_keyboard) : base() //NOTE here { //other init stuff } } Now then, look at the noted line. If you remove : base() then it will compile without an error. Why is this? Is there a way to disable this behavior? I have had multiple bugs now from forgetting the base() which I would have thought to be required on such a special thing as a constructor.

    Read the article

  • Good HTML/CSS/PHP editor that is free and multi-platform?

    - by Earlz
    Hello, I have recently given up on using Visual Studio for Windows editing. See, PHP isn't really important as I have hardly any pages that use it, but in VS, if it smells PHP then it won't treat it as HTML and thus will all be plainly formatted.. so.. I'm looking for some sorta HTML/CSS/PHP editor that is free and multi-platform(so I can also use it at my home OpenBSD computer) And please don't suggest emacs or vi. I'm learning more and more of nvi, but I'm looking for a graphical editor right now. Can anyone suggest a good editor for my needs?

    Read the article

  • Way to get VS 2008 to stop forcing indentation on namespaces?

    - by Earlz
    I've never really been a big fan of the way most editors handle namespaces. They always force you to add an extra pointless level of indentation. For instance, I have a lot of code in a page that I would much rather prefer formatted as namespace mycode{ class myclass{ void function(){ foo(); } void foo(){ bar(); } void bar(){ //code.. } } } and not something like namespace mycode{ class myclass{ void function(){ foo(); } void foo(){ bar(); } void bar(){ //code.. } } } Honestly, I don't really even like the class thing being indented most of the time because I usually only have 1 class per file. And it doesn't look as bad here, but when you get a ton of code and lot of scopes, you can easily have indentation that forces you off the screen, and plus here I just used 2-space tabs and not 4-space as is used by us. Anyway, is there some way to get Visual Studio to stop trying to indent namespaces for me like that?

    Read the article

  • 1k of Program Space, 64 bytes of RAM. Is assembly an absolute must?

    - by Earlz
    (If your lazy see bottom for TL;DR) Hello, I am planning to build a new (prototype) project dealing with physical computing. Basically, I have wires. These wires all need to have their voltage read at the same time. More than a few hundred microseconds difference between the readings of each wire will completely screw it up. The Arduino takes about 114 microseconds. So the most I could read is 2 or 3 wires before the latency would skew the accuracy of the readings. So my plan is to have an Arduino as the "master" of an array of ATTinys. The arduino is pretty cramped for space, but it's a massive playground compared to the tinys. An ATTiny13A has 1k of flash ROM(program space), 64 bytes of RAM, and 64 bytes of (not-durable and slow) EEPROM. (I'm choosing this for price as well as size) The ATTinys in my system will not do much. Basically, all they will do is wait for a signal from the Master, and then read the voltage of 1 or 2 wires and store it in RAM(or possibly EEPROM if it's that cramped). And then send it to the Master using only 1 wire for data.(no room for more than that!). So far then, all I should have to do is implement trivial voltage reading code (using built in ADC). But this communication bit I'm worried about. Do you think a communication protocol(using just 1 wire!) could even be implemented in such constraints? TL;DR: In less than 1k of program space and 64 bytes of RAM(and 64 bytes of EEPROM) do you think it is possible to implement a 1 wire communication protocol? Would I need to drop to assembly to make it fit? I know that currently my Arduino programs linking to the Wiring library are over 8k, so I'm a bit concerned.

    Read the article

  • How to completely wipe rubygems along with rails etc

    - by Earlz
    Ok, so I decided I'd be cool and try to use Rails3 that's in beta. Then, things were getting hard to manage so I got rvm. I installed ruby 1.9.2-head in rvm and things were working, and then a computer restart later rails wouldn't start up. So I figured I'd just try running the system ruby and start rails in it. same error. Then, I uninstalled rails3 and got rails: no such file or directory type errors.. So now I'm royally screwed because rails2 is still installed but will not uninstall because of invisible dependencies, along with a lot of other random gems. How do I completely clear out all ruby gems and such so I can start anew?

    Read the article

  • What things on a job listing should be avoided?

    - by Earlz
    Hello, I'm looking at trying my hand at a bit of freelancing. And looking at some of the listings, I can tell some of them are definitely, obviously wrong. "A web application mimicking youtube. Project must be completed in 2 weeks. Flat payment of $200. If you are not willing to do things this fast paced then do not apply" But some of them are more subtle and they give me a red flag inside, but I'm not sure to avoid them. What are some things in job listings to avoid for freelance programming jobs? What is the reason for avoiding that?

    Read the article

  • Understanding MongoDB (and NoSQL in general) and how to make the best use of it

    - by Earlz
    Hello, I am beginning to think that my next project I am wanting to do would work better with a NoSQL solution. The project would either involve a ton of 2-column tables or a ton of dynamic queries with dynamically generated columns in a traditional SQL database. So I feel a NoSQL database would be much cleaner. I'm looking at MongoDB and it looks pretty promising. Anyway, I'm attempting to make sense of it all. Also, I will be using MongoMapper in Ruby. Anyway though, I'm confused as to how to layout things in such a freeform database. I've read http://stackoverflow.com/questions/2170152/nosql-best-practices and the answer there says that normalization is usually bad in a NoSQL DB. So how would be the best way of laying out say a simple blog with users, posts, and comments? My natural thought was to have three collections for each and then link them by a unique ID. But this apparently is wrong? So, what are some of the ways to lay out such a thing? My concern with the answer given in the other question is, what if the author's name changed? You'd have to go through updating a ton of posts and comments. But is this an okay thing to do with NoSQL?

    Read the article

  • Understanding MongoDB(and NoSQL in general) and How to make the best use of it

    - by Earlz
    Hello, I am beginning to think that my next project I am wanting to do would work better with a NoSQL solution. The project would either involve a ton of 2-column tables or a ton of dynamic queries with dynamically generated columns in a traditional SQL database. So I feel a NoSQL database would be much cleaner. I'm looking at MongoDB and it looks pretty promising. Anyway, I'm attempting to make sense of it all. Also, I will be using MongoMapper in Ruby. Anyway though, I'm confused as to how to layout things in such a freeform database. I've read http://stackoverflow.com/questions/2170152/nosql-best-practices and the answer there says that normalization is usually bad in a NoSQL DB. So how would be the best way of laying out say a simple blog with users, posts, and comments? My natural thought was to have 3 collections for each and then link them by a unique ID. But this apparently is wrong? So, what are some of the ways to lay out such a thing? My concern with the answer given in the other question is what if the author's name changed. You'd have to go through updating a ton of posts and comments. But is this an ok thing to do with NoSQL?

    Read the article

  • 1k of Program Space, 64 bytes of RAM. Is 1 wire communication possible?

    - by Earlz
    (If your lazy see bottom for TL;DR) Hello, I am planning to build a new (prototype) project dealing with physical computing. Basically, I have wires. These wires all need to have their voltage read at the same time. More than a few hundred microseconds difference between the readings of each wire will completely screw it up. The Arduino takes about 114 microseconds. So the most I could read is 2 or 3 wires before the latency would skew the accuracy of the readings. So my plan is to have an Arduino as the "master" of an array of ATTinys. The arduino is pretty cramped for space, but it's a massive playground compared to the tinys. An ATTiny13A has 1k of flash ROM(program space), 64 bytes of RAM, and 64 bytes of (not-durable and slow) EEPROM. (I'm choosing this for price as well as size) The ATTinys in my system will not do much. Basically, all they will do is wait for a signal from the Master, and then read the voltage of 1 or 2 wires and store it in RAM(or possibly EEPROM if it's that cramped). And then send it to the Master using only 1 wire for data.(no room for more than that!). So far then, all I should have to do is implement trivial voltage reading code (using built in ADC). But this communication bit I'm worried about. Do you think a communication protocol(using just 1 wire!) could even be implemented in such constraints? TL;DR: In less than 1k of program space and 64 bytes of RAM(and 64 bytes of EEPROM) do you think it is possible to implement a 1 wire communication protocol? Would I need to drop to assembly to make it fit? I know that currently my Arduino programs linking to the Wiring library are over 8k, so I'm a bit concerned.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >