improvement

Where would I find critiques for my source code?

Well the most obvious answer is here. Self taught programming has some down sides, one of which is the lack of code peer critique which can help one expand his/her programming scope. Since I'm working by myself, what would be a great way for me to get some critique on all of my source code (like a really long source code)? ...

Codeigniter: Improve code check function

I have the following function that checks to make sure the code entered matches one in a database. If it does, it adds one credit to the user, and subtracts one from the corresponding row. else if ($code_enter != NULL){ $code_check = $this->CI->db->select('code')->from('be_coupons')->where('code', $code_enter)->limit(1)->g...

A more pretty/informative Var_dump alternative in PHP?

Every decent programmer has a print_r or var_dump wrapper they use, love and assign shortcut keys to, why don't we share our favourite ones. I am using a simple one, here: function dump($var = null) { static $dumpId = 0; if($dumpId == 0) { echo '<style>pre {margin: 0px; text-align: left; color: #000; padding: 0px; font...

Paginating requests to an API

I'm consuming (via urllib/urllib2) an API that returns XML results. The API always returns the total_hit_count for my query, but only allows me to retrieve results in batches of, say, 100 or 1000. The API stipulates I need to specify a start_pos and end_pos for offsetting this, in order to walk through the results. Say the urllib reques...

Slider with buttons. How to improve?

I need to make slider. I have content (which should shift horizontally) and two buttons - "right" and "left". If you press the button and hold it, the content starts to move (in the appropriate direction). If you not hold the button, then the movement stops. This behavior is copies the behavior of usual window scrollbar. I wrote code...

Wrapping element in choose construction. How to improve?

Is there any way to optimize this code. <xsl:choose> <xsl:when test="val1 = val2"> <xsl:apply-templates select="node"/> </xsl:when> <xsl:otherwise> <div> <xsl:apply-templates select="node"/> </div> </xsl:otherwise> </xsl:choose> I do not like having to write twice the same <xsl:appl...

Specific template for the first element.

I have a template: <xsl:template match="paragraph"> ... </xsl:template> I call it: <xsl:apply-templates select="paragraph"/> For the first element I need to do: <xsl:template match="paragraph[1]"> ... <xsl:apply-templates select="."/><!-- I understand that this does not work --> ... </xsl:template> How to call <x...

need help in improving Horizontal sliding div

I have script: http://jsfiddle.net/NV2uV/ It works, but I do not like. Cons: Wrench (edge blocks). In the transition from one unit to another - animation is performed in two steps (I want a continuous animation). Script code is not beautiful, very much repetition. In short - it looks not nice. How to improve the script to look at...

Nodes set of the same type with if-test. Make it less.

How to make the code more beautiful (compact)? <xsl:template match="part"> <table class="part"> <xsl:if test="name != ''"> <tr> <td>Название</td><td><xsl:value-of select="name"/></td> </tr> </xsl:if> <xsl:if test="model != ''"> <tr> <td>Модел...

Split node list to parts.

xml: <mode>1</mode> <mode>2</mode> <mode>3</mode> <mode>4</mode> <mode>5</mode> <mode>6</mode> <mode>7</mode> <mode>8</mode> <mode>9</mode> <mode>10</mode> <mode>11</mode> <mode>12</mode> i need to separate it on parts (for ex. on 4): xslt: <xsl:variable name="vNodes" select="mode"/> <xsl:variable name="vNumParts" select="4"/> <xsl:...

Any way to improve this python function?

def __number(): # This line returns the number of the latest created object # as a "Factura" object in format "n/year" last = Factura.objects.filter(f_type__exact=False).latest('number') # We convert it into a string and split it to get only the first number spl = str(last).split('/')[0] # Convert it into intege...

Software to Improve OCR Results Based on Output from Multiple OCR Software Packages

Is there an already-existing piece of commercial or academic software that can overlay results from multiple OCR packages (Abbyy FineReader, Adobe Acrobat Professional, ReadIris, etc.) provide fully automated improvements based on accumulated knowledge from multiple sources allow for use of additional external tools setup at runtime (d...

How to improve web App

I would love my client's web app to take off, but I feel that there is much improvement to be had before it can be completely usable. What are some resources that will allow me to get feedback and advice/suggestions for improvement/addition of features that will make it more usable?! If you'd like to take a look yourself see it here. R...

New project - should I learn new language or use a language I already know

Afternoon. I have left the names of the languages out of the question, to keep it general and to stop flame wars. I am about to start a new project, and I would usually use language A. I am good at language A but it's the only 'web' language I know. Languages B and C also interest me but I haven't used them at all before therefore it'...