code

Posting code to the forum

When posting code to the forums, copy from a text editor such as notepad, not from word or Outlook. Be sure to click the HTML tab BEFORE you paste your text.

Click on the "html" mode tab on your "reply" dialog box. Then wrap your text with like this:

pasted text

NOTE: Do not put a space in the I have done that here so it will show up as text. Also, be sure to click the HTML tab BEFORE you paste your text. This is how it will look when coded correctly pasted text


Originally posted in cdnusers.org by Administrator




code

Welcome! Please use this forum to upload your code

Please include a brief summary of how to use it.




code

e-code: Macro example code for Team Specman blog post

Hi everybody,

 

The attached package is a tiny code example with a demo for an upcoming Team Specman blog post about writing macros.

 

Hilmar




code

ctags for e code, Vim compatible

In a nutshell, tags allows you to navigate through program code distributed over multiple files effectively. e.g if you see a function call or a struct in e-code and want to "jump" to the definition (which may be in a different file) then you just hit CTRL+] in Vim! Pressing CTRL+t will take you back where you came from. Check out http://vim.wikia.com/wiki/Browsing_programs_with_tags#Using_tags if you want to learn more about how to use tags with Vim.

This utility can generate tags file for your e files. It can either walk through e import order, a directory recursively or all directories on SPECMAN_PATH recursively! The tags file will have tags for struct, unit, types, events, defines, fields, variables, etc.

For help and some examples, just run ctags4e -help.

 

 




code

e-code: Shareware RAM

Modified version of shr_ram from erm_lib to support mvl_values
regards: snaptube




code

Allegro PCB Router quit unexpectedly with an exit code of -1073741701. Also, nothing is logged in log file.

Has anyone experienced the same situation?




code

Iran uses 'mental health' pretext to downplay woman’s dress code protest

Witness reports and Iran’s systematic use of punitive psychiatry to undermine dissent contradict government claims that the woman had a mental health crisis and was not protesting enforcement of the country’s mandatory dress code.




code

turn off maintenance message on volvo xc90 code 045

turn off maintenance message on volvo xc90 code 045




code

4650 service code

4650 service code




code

Taking Codeine While Breastfeeding May Harm Infant

Title: Taking Codeine While Breastfeeding May Harm Infant
Category: Health News
Created: 8/26/2008 2:00:00 AM
Last Editorial Review: 8/26/2008 12:00:00 AM




code

AI could help shrinking pool of coders keep outdated programs working

Computer code dating back to the 1960s is still vital to banks, airlines and governments, but programmers familiar with the language are in short supply. Now AI models are being trained to fill the skills gap




code

Generative AI creates playable version of Doom game with no code

A neural network can recreate the classic computer game Doom despite using none of its code or graphics, hinting that generative AI could be used to create games from scratch in future




code

FDA updates Food Code for the 50 states

The U.S. Food and Drug Administration has published the 2022 Food Code Supplement. The Supplement updates the 2022 Food Code with recommendations from regulatory officials, industry, academia, and consumers at the 2023 Biennial Meeting of the Conference for Food Protection.  The Food Code and its Supplement provide the government and industry with... Continue Reading




code

How Signal Decoders Are Used in Radio Broadcasting

Signal decoders are vital components in radio broadcasting. Without them, the transmission and reception of clear audio or data would be impossible. They take what is essentially noise and turn it into coherent, useful information. Having worked with radio broadcasting systems for some time, I’ve seen firsthand how essential decoders are to maintaining communication networks. […]

The post How Signal Decoders Are Used in Radio Broadcasting appeared first on Chart Attack.




code

250737: NSA Menon discusses regional security and trade issues with Codel McCaskill

In a wide-ranging meeting with CODEL McCaskill February 17, National Security Advisor Shivshankar Menon touched on several regional security and trade-related issues.




code

155753: Codel Feingold meets with President Musharraf

President Musharraf also asked the U.S. to put more pressure on India to negotiate over Kashmir, concluding that the time is ripe for resolution of the issue.




code

248366: Scenesetter for Codel Kerry's visit to India

You will find an Indian government that is more committed than ever to building a durable and wide ranging USG-GOI relationship after Prime Minister Singh's Washington visit in November.




code

Garena Free Fire Max Redeem Codes for November 13, 2024: Unlock Exclusive In-Game Rewards

Redeem Codes for Garena Free Fire Max on November 13, 2024: Gain an advantage over your opponents or enhance your character's appearance with these codes, offering in-game items for free. Acquire weapons, skins, diamonds, and more through these codes. Garena Free Fire




code

CodeSOD: Querieous Strings

When processing HTTP requests, you frequently need to check the parameters which were sent along with that request. Those parameters are generally passed as stringly-typed key/value pairs. None of this is news to anyone.

What is news, however, is how Brodey's co-worker indexed the key/value pairs.

For i As Integer = 0 To (Request.Params().Count - 1)
    If (parameters.GetKey(i).ToString() <> "Lang") Then
        If (parameters.GetKey(i).Equals("ID")) OrElse (parameters.GetKey(i).Equals("new")) OrElse _
             (parameters.GetKey(i).Equals("open")) OrElse (parameters.GetKey(i).Equals("FID")) _
         OrElse (parameters.GetKey(i).Equals("enabled")) OrElse (parameters.GetKey(i).Equals("my")) OrElse _
         (parameters.GetKey(i).Equals("msgType")) OrElse (parameters.GetKey(i).Equals("Type")) _
         OrElse (parameters.GetKey(i).Equals("EID")) OrElse (parameters.GetKey(i).Equals("Title")) OrElse _
         (parameters.GetKey(i).Equals("ERROR")) Then
            URLParams &= "&" & parameters.GetKey(i).ToString()
            URLParams &= "=" & parameters(i).ToString()
        End If
    End If
Next

The goal of this code is to take a certain set of keys and construct a URLParams string which represents those key/values as an HTTP query string. The first thing to get out of the way: .NET has a QueryString type that handles the construction of the query string for you (including escaping), so that you don't need to do any string concatenation.

But the real WTF is everything surrounding that. We opt to iterate across every key- not just the ones we care about- and use the GetKey(i) function to check each individual key in an extensive chain of OrElse statements.

The obvious and simpler approach would have been to iterate across an array of the keys I care about- ID, new, FID, enabled, my, msgType, Type, EID, Title, ERROR- and simply check if they were in the Request.

I suppose the only silver lining here is that they thought to use the OrElse operator- which is a short-circuiting "or" operation, like you'd expect in just about any other language, instead of Or, which doesn't short circuit (pulling double duty as both a bitwise Or and a logical Or, because Visual Basic wants to contribute some WTFs).

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!




code

CodeSOD: Join Our Naming

As a general rule, if you're using an RDBMS and can solve your problem using SQL, you should solve your problem using SQL. It's how we avoid doing joins or sorts in our application code, which is always a good thing.

But this is a general rule. And Jasmine sends us one where solving the problem as a query was a bad idea.

ALTER   FUNCTION [dbo].[GetName](@EntityID int)

RETURNS varchar(200)

AS

BEGIN

declare @Name varchar(200)

select @Name =
  case E.EntityType
    when 'Application'  then A.ApplicationName
    when 'Automation'   then 'Automated Process'
    when 'Group'        then G.GroupName
    when 'Organization' then O.OrgName
    when 'Person'       then P.FirstName + ' ' + P.LastName
    when 'Resource'     then R.ResourceName
    when 'Batch'        then B.BatchComment
  end
from Entities E
left join AP_Applications A   on E.EntityID = A.EntityID
left join CN_Groups G         on E.EntityID = G.EntityID
left join CN_Organizations O  on E.EntityID = O.EntityID
left join CN_People P         on E.EntityID = P.EntityID
left join Resources R         on E.EntityID = R.EntityID
left join AR_PaymentBatches B on E.EntityID = B.EntityID
where E.EntityID = @EntityID

return @Name

END

The purpose of this function is to look up the name of an entity. Depending on the kind of entity we're talking about, we have to pull that name from a different table. This is a very common pattern in database normalization- a database equivalent of inheritance. All the common fields to all entities get stored in an Entities table, while specific classes of entity (like "Applications") get their own table which joins back to the Entities table.

On the surface, this code doesn't even really look like a WTF. By the book, this is really how you'd write this kind of function- if we were going by the book.

But the problem was that these tables were frequently very large, and even with indexes on the EntityID fields, it simply performed horribly. And since "showing the name of the thing you're looking at" was a common query, that performance hit added up.

The fix was easy- write out seven unique functions- one for each entity type- and then re-write this function to use an IF statement to decide which one to execute. The code was simpler to understand and read, and performed much faster.

In the end, perhaps not really a WTF, or perhaps the root WTF is some of the architectural decisions which allow this to exist (why a function for getting the name, and the name alone, which means we execute this query independently and not part of a more meaningful join?). But I think it's an interesting example of how "this is the right way to do it" can lead to some unusual outcomes.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!




code

CodeSOD: Trophy Bug Hunting

Quality control is an important business function for any company. When your company is shipping devices with safety concerns, it's even more important. In some industries, a quality control failure is bound to be national headlines.

When the quality control software tool stopped working, everyone panicked. At which point, GRH stepped in.

Now, we've discussed this software and GRH before, but as a quick recap, it was:

written by someone who is no longer employed with the company, as part of a project managed by someone who is no longer at the company, requested by an executive who is also no longer at the company. There are no documented requirements, very few tests, and a lot of "don't touch this, it works".

And this was a quality control tool. So we're already in bad shape. It also had been unmaintained for years- a few of the QC engineers had tried to take it over, but weren't programmers, and it had essentially languished.

Specifically, it was a quality control tool used to oversee the process by about 50 QC engineers. It automates a series of checks by wrapping around third party software tools, in a complex network of "this device gets tested by generating output in program A, feeding it to program B, then combining the streams and sending them to the device, but this device gets tested using programs D, E, and F."

The automated process using the tool has a shockingly low error rate. Without the tool, doing things manually, the error rate climbs to 1-2%. So unless everyone wanted to see terrifying headlines in the Boston Globe about their devices failing, GRH needed to fix the problem.

GRH was given the code, in this case a a zip file on a shared drive. It did not, at the start, even build. After fighting with the project configuration to resolve that, GRH was free to start digging in deeper.

Public Sub connect2PCdb()
        Dim cPath As String = Path.Combine(strConverterPath, "c.pfx")
        Dim strCN As String

        ' JES 12/6/2016: Modify the following line if MySQL server is changed to a different server.  A dump file will be needed to re-create teh database in the new server.
        strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;database=REDACTED;sslmode=Required;certificatepassword=REDACTED;certificatefile=REDACTEDc.pfx;password=REDACTED'"
        strCN = Regex.Replace(strCN, "certificatefile=.*?pfx", "certificatefile=" & cPath)
        pcContext = New Entities(strCN)
        strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;persistsecurityinfo=True;database=REDACTED;password=REDACTED'"
        strCN = Regex.Match(strCN, ".*'(.*)'").Groups(1).Value

        Try
            strCN = pcContext.Database.Connection.ConnectionString
            cnPC.ConnectionString = "server=REDACTED;user id=REDACTED;password=REDACTED;database=REDACTED;"
            cnPC.Open()
        Catch ex As Exception

        End Try
    End Sub

This is the code which connects to the backend database. The code is in the category of more of a trainwreck than a WTF. It's got a wonderful mix of nonsense in here, though- a hard-coded connection string which includes plaintext passwords, regex munging to modify the string, then hard-coding a string again, only to use regexes to extract a subset of the string. A subset we don't use.

And then, for a bonus, the whole thing has a misleading comment- "modify the following line" if we move to a different server? We have to modify several lines, because we keep copy/pasting the string around.

Oh, and of course, it uses the pattern of "open a database connection at application startup, and just hold that connection forever," which is a great way to strain your database as your userbase grows.

The good news about the hard-coded password is that it got GRH access to the database. With that, it was easy to see what the problem was: the database was full. The system was overly aggressive with logging, the logs went to database tables, the server was an antique with a rather small hard drive, and the database wasn't configured to even use all of that space anyway.

Cleaning up old logs got the engineers working again. GRH kept working on the code, though, cleaning it up and modernizing it. Updating to latest version of the .NET Core framework modified the data access to be far simpler, and got rid of the need for hard-coded connection strings. Still, GRH left the method looking like this:

    Public Sub connect2PCdb()
        'Dim cPath As String = Path.Combine(strConverterPath, "c.pfx")
        'Dim strCN As String

        ' JES 12/6/2016: Modify the following line if MySQL server is changed to a different server.  A dump file will be needed to re-create teh database in the new server.
        'strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;database=REDACTED;sslmode=Required;certificatepassword=REDACTED;certificatefile=REDACTEDc.pfx;password=REDACTED'"
        'strCN = Regex.Replace(strCN, "certificatefile=.*?pfx", "certificatefile=" & cPath)
        'pcContext = New Entities(strCN)
        'strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;persistsecurityinfo=True;database=REDACTED;password=REDACTED'"
        'strCN = Regex.Match(strCN, ".*'(.*)'").Groups(1).Value

        'GRH 2021-01-15.  Connection information moved to App.Config
        'GRH 2021-08-13.  EF Core no longer supports App.Config method
        pcContext = New PcEntities

        Try
            ' GRH 2021-08-21  This variable no longer exists in .NET 5
            'strCN = pcContext.Database.Connection.ConnectionString
            ' GRH 2021-08-20  Keeping the connection open causes EF Core to not work
            'cnPC.ConnectionString = "server=REDACTED;user id=REDACTED;password=REDACTED;database=REDACTED;SslMode=none"
            'cnPC.Open()
        Catch ex As Exception

        End Try
    End Sub

It's now a one-line method, with most of the code commented out, instead of removed. Why on Earth is the method left like that?

GRH explains:

Yes, I could delete the function as it is functionally dead, but I keep it for the same reasons that a hunter mounts a deer's head above her mantle.

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!




code

CodeSOD: A Base Nature

Once again, we take a look at the traditional "if (boolean) return true; else return false;" pattern. But today's, from RJ, offers us a bonus twist.

public override bool IsValid
{
   get
   {
      if (!base.IsValid)
         return false;

      return true;
   }
}

As promised, this is a useless conditional. return base.IsValid would do the job just as well. Except, that's the twist, isn't it. base is our superclass. We're overriding a method on our superclass to… just do what the base method does.

This entire function could just be deleted. No one would notice. And yet, it hasn't been. Everyone agrees that it should be, yet it hasn't been. No one's doing it. It just sits there, like a pimple, begging to be popped.

[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.




code

CodeSOD: All the Rest Have 31

Horror movies, as of late, have gone to great lengths to solve the key obstacle to horror movies- cell phones. When we live in a world where help is a phone call away, it's hard to imagine the characters not doing that. So screenwriters put them in situations where this is impossible: in Midsommar they isolate them in rural Sweden, in Get Out calling the police is only going to put our protagonist in more danger. But what's possibly more common is making the film a period piece- like the X/Pearl/Maxxxine trilogy, Late Night with the Devil, or Netflix's continuing series of R.L. Stine adaptations.

I bring this up, because today's horror starts in 1993. A Norwegian software company launched its software product to mild acclaim. Like every company, it had its ups and downs, its successes and missteps. On the surface, it was a decent enough place to work.

Over the years, the company tried to stay up to date with technology. In 1993, the major languages one might use for launching a major software product, your options are largely C or Pascal. Languages like Python existed, but weren't widely used or even supported on most systems. But the company stayed in business and needed to update their technology as time passed, which meant the program gradually grew and migrated to new languages.

Which meant, by the time Niklas F joined the company, they were on C#. Even though they'd completely changed languages, the codebase still derived from the original C codebase. And that meant that the codebase had many secrets, dark corners, and places a developer should never look.

Like every good horror movie protagonist, Niklas heard the "don't go in there!" and immediately went in there. And lurking in those shadows was the thing every developer fears the most: homebrew date handling code.

/// <summary>
/// 
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static DateTime LastDayInMonth(DateTime dt)
{
	int day = 30;
	switch (dt.Month)
	{
		case 1:
			day = 31;
			break;
		case 2:
			if (IsLeapYear(dt))
				day = 29;
			else
				day = 28;
			break;
		case 3:
			day = 31;
			break;
		case 4:
			day = 30;
			break;
		case 5:
			day = 31;
			break;
		case 6:
			day = 30;
			break;
		case 7:
			day = 31;
			break;
		case 8:
			day = 31;
			break;
		case 9:
			day = 30;
			break;
		case 10:
			day = 31;
			break;
		case 11:
			day = 30;
			break;
		case 12:
			day = 31;
			break;
	}
	return new DateTime(dt.Year, dt.Month, day, 0, 0, 0);
}

/// <summary>
/// 
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static bool IsLeapYear(DateTime dt)
{
	bool ret = (((dt.Year % 4) == 0) && ((dt.Year % 100) != 0) || ((dt.Year % 400) == 0));
	return ret;
}

For a nice change of pace, this code isn't incorrect. Even the leap year calculation is actually correct (though my preference would be to just return the expression instead of using a local variable). But that's what makes this horror all the more insidious: there are built-in functions to handle all of this, but this code works and will likely continue to work, just sitting there, like a demon that we've made a pact with. And suddenly we realize this isn't Midsommar but Ari Aster's other hit film, Hereditary, and we're trapped being in a lineage of monsters, and can't escape our inheritance.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!




code

CodeSOD: A Matter of Understanding

For years, Victoria had a co-worker who "programmed by Google Search"; they didn't understand how anything worked, they simply plugged their problem into Google search and then copy/pasted and edited until they got code that worked. For this developer, I'm sure ChatGPT has been a godsend, but this code predates its wide use. It's pure "Googlesauce".

    StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append("SELECT * FROM TABLE1 WHERE COLUMN1 = 1 WITH UR");

    String sqlStr = stringBuffer.toString();
    ps = getConnection().prepareStatement(sqlStr);

    ps.setInt(1, code);

    rs = ps.executeQuery();

    while (rs.next())
    {
      count++;
    }

The core of this WTF isn't anything special- instead of running a SELECT COUNT they run a SELECT and then loop over the results to get the count. But it's all the little details in here which make it fun.

They start by using a StringBuffer to construct their query- not a horrible plan when the query is long, but this is just a single, simple, one-line query. The query contains a WITH clause, but it's in the wrong spot. Then they prepareStatement it, which does nothing, since this query doesn't contain any parameters (and also, isn't syntactically valid). Once it's prepared, they set the non-existent parameter 1 to a value- this operation will throw an exception because there are no parameters in the query.

Finally, they loop across the results to count.

The real WTF is that this code ended up in the code base, somehow. The developer said, "Yes, this seems good, I'll check in this non-functional blob that I definitely don't understand," and then there were no protections in place to keep that from happening. Now it falls to more competent developers, like Victoria, to clean up after this co-worker.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!




code

CodeSOD: Counting it All

Since it's election day in the US, many people are thinking about counting today. We frequently discuss counting here, and how to do it wrong, so let's look at some code from RK.

This code may not be counting votes, but whatever it's counting, we're not going to enjoy it:

case LogMode.Row_limit: // row limit excel = 65536 rows
    if (File.Exists(personalFolder + @"" + fileName + ".CSV"))
    {
        using (StreamReader reader = new StreamReader(personalFolder + @"" + fileName + ".CSV"))
        {
            countRows = reader.ReadToEnd().Split(new char[] { '
' }).Length;
        }
    }

Now, this code is from a rather old application, originally released in 2007. So the comment about Excel's row limit really puts us in a moment in time- Excel 2007 raised the row limit to 1,000,000 rows. But older versions of Excel did cap out at 65,536. And it wasn't the case that everyone just up and switched to Excel 2007 when it came out- transitioning to the new Office file formats was a conversion which took years.

But we're not even reading an Excel file, we're reading a CSV.

I enjoy that we construct the name twice, because that's useful. But the real magic of this one is how we count the rows. Because while Excel can handle 65,536 rows at this time, I don't think this program is going to do a great job of it- because we read the entire file into memory with ReadToEnd, then Split on newlines, then count the length that way.

As you can imagine, in practice, this performed terribly on large files, of which there were many.

Unfortunately for RK, there's one rule about old, legacy code: don't touch it. So despite fixing this being a rather easy task, nobody is working on fixing it, because nobody wants to be the one who touched it last. Instead, management is promising to launch a greenfield replacement project any day now…

[Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.




code

CodeSOD: Uniquely Validated

There's the potential for endless installments of "programmers not understanding how UUIDs work." Frankly, I think the fact that we represent them as human readable strings is part of the problem; sure, it's readable, but conceals the fact that it's just a large integer.

Which brings us to this snippet, from Capybara James.

    if (!StringUtils.hasLength(uuid) || uuid.length() != 36) {
        throw new RequestParameterNotFoundException(ErrorCodeCostants.UUID_MANDATORY_OR_FORMAT);
    }

StringUtils.hasLength comes from the Spring library, and it's a simple "is not null or empty" check. So- we're testing to see if a string is null or empty, or isn't exactly 36 characters long. That tells us the input is bad, so we throw a RequestParameterNotFoundException, along with an error code.

So, as already pointed out, a UUID is just a large integer that we render as a 36 character string, and there are better ways to validate a UUID. But this also will accept any 36 character string- as long as you've got 36 characters, we'll call it a UUID. "This is valid, really valid, dumbass" is now a valid UUID.

With that in mind, I also like the bonus of it not distinguishing between whether or not the input was missing or invalid, because that'll make it real easy for users to understand why their input is getting rejected.

[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.




code

CodeSOD: Pay for this Later

Ross needed to write software to integrate with a credit card payment gateway. The one his company chose was relatively small, and only served a handful of countries- but it covered the markets they cared about and the transaction fees were cheap. They used XML for data interchange, and while they had no published schema document, they did have some handy-dandy sample code which let you parse their XML messages.

$response = curl_exec($ch);
$authecode = fetch_data($response, '<authCode>', '</authCode>');
$responsecode = fetch_data($response, '<responsecode>', '</responsecode>');
$retrunamount = fetch_data($response, '<returnamount>', '</returnamount>');
$trxnnumber = fetch_data($response, '<trxnnumber>', '</trxnnumber>');
$trxnstatus = fetch_data($response, '<trxnstatus>', '</trxnstatus>');
$trxnresponsemessage = fetch_data($response, '<trxnresponsemessage>', '</trxnresponsemessage>');

Well, this looks… worrying. At first glance, I wonder if we're going to have to kneel before Z̸̭͖͔͂̀ā̸̡͖͕͊l̴̜͕͋͌̕g̸͉̳͂͊ȯ̷͙͂̐. What exactly does fetch_data actually do?

function fetch_data($string, $start_tag, $end_tag)
{

  $position = stripos($string, $start_tag);
  $str = substr($string, $position);
  $str_second = substr($str, strlen($start_tag));
  $second_positon = stripos($str_second, $end_tag);
  $str_third = substr($str_second, 0, $second_positon);
  $fetch_data = trim($str_third);
  return $fetch_data;
}

Phew, no regular expressions, just… lots of substrings. This parses the XML document with no sense of the document's structure- it literally just searches for specific tags, grabs whatever is between them, and calls it done. Nested tags? Attributes? Self-closing tags? Forget about it. Since it doesn't enforce that your open and closing tags match, it also lets you grab arbitrary (and invalid) document fragments- fetch_data($response, "<fooTag>", "<barTag>"), for example.

And it's not like this needs to be implemented from scratch- PHP has built-in XML parsing classes. We could argue that by limiting ourselves to a subset of XML (which I can only hope this document does) and doing basic string parsing, we've built a much simpler approach, but I suspect that after doing a big pile of linear searches through the document, we're not really going to see any performance benefits from this version- and maintenance is going to be a nightmare, as it's so fragile and won't work for many very valid XML documents.

It's always amazing when TRWTF is neither PHP nor XML but… whatever this is.

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!




code

Cracking the Code of Emotion

By combining traditional approaches with new technologies, researchers aim to refine the accuracy and reliability of measuring emotions. This exploration




code

Reprogramming Genetic Code for Precision Biology

Most organisms rely on 20 standard medlinkamino acids/medlink to synthesize proteins, with few exceptions. Chemist Han Xiao's research focuses on




code

Codexis to Announce First Quarter 2010 Financial Results May 26, 2010

Codexis to Announce First Quarter 2010 Financial Results May 26, 2010




code

Researchers Decode Brain Bleeding in Premature Newborns

In premature newborns with very low medlinkbirth weight/medlink, immature neurons' salt and water transporters can lead to brain tissue shrinking in response to oxygen deprivation (!--ref1--).




code

Code in Meta’s Threads app references a communities feature, similar to Elon Musk’s X

Meta’s take on a Twitter/X rival, Instagram Threads, may be inching further into its competitor’s territory with the development of a communities feature that would presumably allow users to better organize their discussions on the platform by topics. At least that’s what references in the app’s code seem to imply. The code mentions a new […]

© 2024 TechCrunch. All rights reserved. For personal use only.




code

ChromaCode’s tech to boost COVID-19 testing gets Bill Gates’s backing

Boasting a technology that can dramatically increase the capacity of existing polymerase chain reaction (PCR) testing used to identify people infected with COVID-19 and other illnesses, ChromaCode has attracted new funding from Bill Gates-backed Adjuvant Capital.  “We want a good solution for a resource-limited environment,” says ChromaCode founder and executive chairman Alex Dickinson, a serial entrepreneur […]

© 2024 TechCrunch. All rights reserved. For personal use only.




code

Early automates code testing for developers

Early is a Tel Aviv-based startup that uses generative AI to generate unit tests, helping programmers catch potential bugs early in the development cycle. The company, which launched in August, today announced that it has raised a $5 million seed funding round led by Zeev Ventures, with participation from Dynamic Loop Capital. In its current […]

© 2024 TechCrunch. All rights reserved. For personal use only.




code

Tabnine launches its code review agent

AI code assistant company Tabnine is launching a code review agent today that aims to help developers stick to their organization’s best practices and standards. It allows organizations to codify these rules either by providing the agent with documentation or by pointing it at a set of “golden code repos.” The agent will passively review […]

© 2024 TechCrunch. All rights reserved. For personal use only.




code

GitHub’s Copilot comes to Apple’s Xcode

At its Universe conference, GitHub today announced a number of major new products, including the Spark project for writing applications entirely with AI, as well as multi-model support for its Copilot service. But Copilot itself is also getting quite a few updates. With this release, Microsoft-owned GitHub is bringing Copilot to Apple’s Xcode environment for […]

© 2024 TechCrunch. All rights reserved. For personal use only.




code

Symbiotic Security helps developers find bugs as they code

Symbiotic Security, which is announcing a $3 million seed round today, watches over developers as they code and points out potential security issues in real time. Other companies do this, but Symbiotic also emphasizes the next step: teaching developers to avoid these bugs in the first place. Ideally, this means developers will fix security bugs […]

© 2024 TechCrunch. All rights reserved. For personal use only.





code

420/406/409 Of The Indian Penal Code. ... vs In Re: Dildar Hossain on 11 November, 2024

SEBI and Joint Registrar of Cooperative Societies have not filed their reports.

2. Investigating Officer is directed to communicate this order to the officer concerned of SEBI as well as Mr. P. K. Dutta, learned Advocate who ordinarily represents SEBI as well as the Joint Registrar of Cooperative Societies for due compliance.

3. Let the matters appear on 25.11.2024.

4. Interim order passed earlier shall continue for a period of four weeks from date or until further orders, whichever is earlier. (Ajay Kumar Gupta, J.) (Joymalya Bagchi, J.)




code

Code Read With Sections 66/66B/72 Of The ... vs In Re: Ganesh Narayan Jadhav &amp; Anr on 11 November, 2024

Nobody appears for the petitioners.

2. Accordingly, the application for anticipatory bail is dismissed for default.

(Ajay Kumar Gupta, J.) (Joymalya Bagchi, J.) Signed By : ARUP KUMAR DAS High Court of Calcutta 12 th of November 2024 03:58:09 PM




code

सिर्फ Gpay Code का किया इस्तेमाल, पेट्रोल पंप से की इतने रुपये की चोरी, जानकर हो जाएंगे हैरान

Usage of Google Pay Code To Steal Money On Petrol Pump: डिजिटल पेमेंट का यूज आजकल हर कोई करता है लेकिन आज कल इससे जुड़े कई सारे फ्रॉड और स्कैम भी सामने आ रहे हैं। सिर्फ इतना ही नहीं, लोग चोरी




code

Garena Free Fire Max Redeem Codes for October 31, 2024: Get Access to the Latest In-game Loot

Garena Free Fire Max Redeem Codes for October 31, 2024: Garena Free Fire Max codes can give you an edge over your opponents or to simply enhance your character's aesthetics. These codes can be used to get in-game items for free.




code

Garena Free Fire MAX Redeem Codes for November 1, 2024: Get Exciting In-Game Rewards Daily

Dive into the enthralling world of Garena Free Fire MAX, a game that has taken the Indian gaming community by storm, particularly after its predecessor was banned. This battle royale game stands out with its high-quality graphics and captivating gameplay, drawing




code

Garena Free Fire Max Redeem Codes for November 2, 2024: Get Access to the Latest In-game Loot

Embark on a gaming journey with Garena Free Fire MAX, a title that has become a staple in the Indian gaming community, especially after the ban of its predecessor. This battle royale game, known for its stunning graphics and engaging gameplay,




code

Garena Free Fire Max Redeem Codes for November 4, 2024: Get Access to the Latest Freebies in the Game

Embark on a thrilling gaming journey with Garena Free Fire MAX, a game that has become a household name among Indian gamers. Following the prohibition of its predecessor, Garena Free Fire, this battle royale game has climbed to the top of




code

Garena Free Fire Max Redeem Codes for November 5, 2024: Get Access to the Latest In-game Loot

Unlock the potential of Garena Free Fire Max with the Redeem Codes available on November 5, 2024. They grant you an upper hand against adversaries or allow you to customize your character's appearance with complimentary in-game items. These codes open doors




code

Garena Free Fire Max Redeem Codes for November 6, 2024: Unlock Exclusive In-Game Rewards

Redeem Codes for Garena Free Fire Max on November 6, 2024: Gain an advantage over your opponents or enhance your character's appearance with these codes, offering in-game items for free. Acquire weapons, skins, diamonds, and more through these codes. Garena Free




code

Garena Free Fire Max Redeem Codes for November 7, 2024: Get Access to the Latest In-game Loot

Garena Free Fire Max Redeem Codes for November 7, 2024: Garena Free Fire Max codes can give you an edge over your opponents or to simply enhance your character's aesthetics. These codes can be used to get in-game items for free.




code

Garena Free Fire Max Redeem Codes for November 8, 2024: Get Access to the Latest In-game Loot

Embark on a gaming journey with Garena Free Fire MAX, a title that has become a staple in the Indian gaming community, especially after the ban of its predecessor. This battle royale game, known for its stunning graphics and engaging gameplay,




code

Garena Free Fire MAX Redeem Codes for November 9, 2024: Get Exciting In-Game Rewards Daily

Dive into the enthralling world of Garena Free Fire MAX, a game that has taken the Indian gaming community by storm, particularly after its predecessor was banned. This battle royale game stands out with its high-quality graphics and captivating gameplay, drawing