Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "casting"
To become an engineer (CS/IT) in India, you have to study:
1. 3 papers in Physics (2 mechanics, 1 optics)
2. 1 paper in Chemistry
3. 2 papers in English (1 grammar, 1 professional communication). Sometimes 3 papers will be there.
4. 6 papers in Mathematics (sequences, series, linear algebra, complex numbers and related stuff, vectors and 3D geometry, differential calculus, integral calculus, maxima/minima, differential equations, descrete mathematics)
5. 1 paper in Economics
6. 1 paper in Business Management
7. 1 paper in Engineering Drawing (drawing random nuts and bolts, locus of point etc)
8. 1 paper in Electronics
9. 1 paper in Mechanical Workshop (sheet metal, wooden work, moulding, metal casting, fitting, lathe machine, milling machine, various drills)
And when you jump in real life scenario, you encounter source/revision/version control, profilers, build server, automated build toolchains, scripts, refactoring, debugging, optimizations etc. As a matter of fact none of these are touched in the course.
Sure, they teach you a large set of algorithms, but they don't tell you when to prefer insertion sort over quick sort, quick sort over merge sort etc. They teach you Las Vegas and Monte Carlo algorithms, but they don't tell you that the randomizer in question should pass Die Hard test (and then you wonder why algorithm is not working as expected). They teach compiler theory, but you cannot write a simple parser after passing the course. They taught you multicore architecture and multicore programming, but you don't know how to detect and fix a race condition. You passed entire engineering course with flying colors, and yet you don't know ABC of debugging (I wish you encounter some notorious heisenbug really soon). They taught 2-3 programming languages, and yet you cannot explain simple variable declaration.
And then, they say that you should have knowledge of multiple fields. Oh well! you don't have any damn idea about your major, and now you are talking about knowledge in multiple fields?
What is the point of such education?
PS: I am tired of interviewing shitty candidates with flying colours in their marksheets. Go kids, learn some real stuff first, and then talk some random bullshit.18
(I wrote most of this as a comment in reply about Microsoft buying GitHub on another rant but decided to move it here because it is rant worthy. Also, no, I'm not a Microsoft employee nor do I have any Microsoft stock).
Microsoft buying GitHub makes sense. They contribute more to the open source community on GitHub than any other company. (Side note, they also contribute/have contributed to the Linux Kernel).
Steve Ballmer isn't running the show anymore. Because of that, we have awesome things like:
* Visual Studio Code - Completely free and powerful light weight IDE for coding in just about any script or language. This IDE is also open source, hosted on GitHub. It can be installed on Win/Mac/Linux.
* Visual Studio Community Edition: fully featured flagship IDE free for solo developers and students, can be installed on Win/Mac.
* Fully featured Sql Server running in a Docker container.
* .Net Core, which can be compiled to native binaries of Windows, MacOS AND Linux. You can't even do that with Java, you have to first have the JVM installed in order to run any kind of Java code on any of those operating systems. .Net Core is also an absolutely beautiful framework with so many features at your disposal.
Yes, they've done bonehead things in the past but who/which company hasn't. Yes, they have Cortana. Yes, they force Bing on you when searching with Cortana (does anyone actually regularly use Cortana? Or Bing?). Yes, their operating system costs money. Yes, their malware-style Upgrade-to-Windows-10 tactics were evil and they admitted such. Yes, they brought ads and other unfortunate things to Skype. I'd be lying if I said I wasn't concerned about that Skype bit translating over into GitHub. BUT, the fact that so many of their employees use GitHub daily means they are dogfooding the platform, which is a positive thing.
Despite the flaws, from the perspective of a software engineer they really should be given a lot of credit for all these new directions they are moving in now. They directly aim to help and contribute to the developer community. Plus, Windows 10 is finally getting a dark theme! haha.
I think Microsoft buying GitHub makes a lot of sense. Of course do what you want about it, feel how you want about it, but casting the same ol' shade at them for anything they do seems a bit like automatic reflex more than anything else.
I'm bracing myself for the impending wave of angry hornets from the nest I just kicked. In all seriousness though, I welcome discussion on the topic even if you feel differently than I do. I'm not saying there's no reason to dislike them, just saying there are lots of new reasons to hate them less and/or appreciate what they are doing now.19
My boss is Russian and he sits right next to me. He often talks to himself in Russian (while typing furiously). makes me think he is casting a spell for his code to attack. lol13
Inner Me: Where the fuck is this bug coming from
> Set a breakpoint in every single place where the method I'm using is being called.
> Try calling the method before every function call
Inner Me: FUCKING DAMNIT! It's been hours now
Inner Me: No way it's the library I'm using.
Inner Me: That couldn't possibly be the problem
> Try running it again and delete some more shit
Inner Me: FUCK MEEEEEEEE
> Getting delirious
> Begin to look at some stupid memes.
> Come back to it.
> Have an Ah-ha moment
> Try running it again but rearrange the order of the method calls
> Still no luck
> try git stashing a bunch of my changes
> git stash apply them back
> erase the method call entirely
Inner Me: well that sort of worked, but now all my numbers are incomplete
Inner Me: FUCKING FINE!!! I'LL LOOK IN THE GODDAMN LIBRARY
Inner Me: FUUUUUUUUUUUUUCCCCCCCCKKKKK a stupid integer casting was occuring to my floats!!!
Now Talking to my girlfriend.
Me: The problem was in the library I was using
Girlfriend: How are you going to fix it if it's in the library?
Me: ... I can, because I wrote the library...
Me: FUCK ME RIGHT?
Me: I guess moral of the story; sometimes the problems starts with ourselves
GF: Hahaha. Thats Deeep2
I've been working on implementing a fairly large feature on a project at work--
**Sorry. I should rephrase that**
I've been *trying* to work on implementing a fairly large feature on a project at work.
It's slightly complicated because I'm not as "in the know" with the project as I should be. I get tossed around projects a lot as the only designer+developer so I've got my hands in a lot of buckets... Or git repos I should say... My source tree has a lot of tabs open and each project is run by someone with their own ideologies on how stuff should be done and laid out and what not. Basically jumping between these projects leaves you mildly capable on all of them but not amazing at any of individual one them--
There's a bug I've been trying to fix.
--Stupid simple bug, literally just a casting issue or something but there's so much data in this one object that it's taking a few solid minutes of concentration to figure out which variable is busting it all up. It shouldn't take long to fix...
But it has. It has taken 4 days.
...To fix what is basically a null reference exception.
Every time I sit down to work on this bug real quick I get pulled away to do a wireframe or change a flow chart or diagram or colour or print styling.
Every. God. Damn. Time.
4 days. Soon to be 5.
My commits are real low at this point guys.
Please boss man, just let me code...4
The new mobile app codebase i'm working with, was clearly written by someone who just read a book on generics and encapsulation.
I need to pull out 2 screens into a separate library to have it shared around. The 1 networking request used is wrapped up in a 'WebServiceFactory' and `WebServiceObjectMapper`, used by a `NetworkingManager` which exposes a generic `request` method taking in a `TopLevelResponse` type (Which has imported every model) which uses a factory method to get the real response type.
This is needed by the `Router` which takes a generic `Action` which they've subclassed for each and every use case needing server communication.
Then the networking request function is part of a chain of 4 near identical functions spread across 4 different files, each one doing a tiny bit more than the last and casting everything to a new god damn protocol, because fuck concrete types.
Its not even used in that many places, theres like 6 networking calls. Why are people so god damn fucking stupid and insist on over engineering the shit out of their apps. I'm fed the fuck up with these useless skidmarks.3
Me: Return data from Firebase into unity project
Firebase: Returns data as object
*Type casting fails for 6hrs*
Finally find the reason Data return type is int64 and I was saving as int32
Now I sit and question my life while listening to epic music2
Senior E: "Man, every time I do code review I thought this is the stupidest code ever written - then I look at the author, oh wait it's me"
Me: "Well, the perfect code is the code never gets written"
SE: "Casting appreciative look with a nod"
I'm basically an introvert. I've lived most of my childhood with my mother alone with few friends and the ones I had betreyed me real hard at some point. So how come that I'm now founding a startup, speaking in front of a big audience at meetups and have a nearly 60/40 work/social life?
At some point I decided to be more social. Making that decision alone had a huge impact. It took several years though, to implement this decision. Some day I cut off my draining social bounds and found energyzing relationships by simple doing what I wanted to do. I started to reach out and experiment with a lot of hobbies like bow casting and going to board games evenings. I made little steps. E.g bow casting is a sport where you don't necessarily interact with others within the sport, but you have the opportunity to interact about the sport.
A physiologist once told me the neat fact, that being an introvert is just an attribute that does not contradict the skill being socially involved. So it is possible with training and decisions to learn how to be more extroverted. For in introvert this is more exhausting and challanging, but definitely possible.
So today I balance my social life and work by visiting meetups, playing board games and all that stuff that makes me comfortable. There I get to know people with similar interests and similar struggle ;)
At some point the work was just not enough to be happy, I identified my missing social interactions as the root cause so I decided to change that.
On the other hand, don't think you have to be social. Don't think you have to care about everything others expect you to care about. It's bullshit. Don't care about that. Rather ask yourself what you want for yourself. Certainly a social life is part of that, but you alone decide how this will look like. E.g. After I decided hey I just don't give a fuck if you like cuddling your cat and when it's birthday is, several months or years later I started to be interested in these things from my own, not because some dippshit society construct expects me to care about it.
So to wrap up:
Introvert is an attribute, social life is a skill.
Deciding for yourself and giving a fuck about others is key.
It takes a shit load of time. But it works.
In the royal city of Aagra. My phone broke and knowing the exploitative bitch I used to meet back then I was certain had I disappeared amid a conversation she would break up with me, so I debugged an Android 2.3 image with no documentation and shaky hands from frustration while cursing her every family member in Hungarian. (Passers-by probably thought I was casting spells on my computer)20
Common Lisp code has (imo) one of the cleanest syntax possible in programming language. I really would like for Lisp dialects other than Clojure to make a heavy comeback. And we now hace Quicklisp which is a package repo for CL code.
I really want to see more people into Lisp, it really is a great language man you just need to get past the (()) and it makes sense I promise.
Guys please try CL. If you already have awesome code skills and have some free time try going throughe the gigamonkeys book. Completely free online and setting up an Emacs environment with SBCL or CLISP is a breeze. I use Lisp to experiment and it gives a lot of room for exploring new concepts.
Another cool language that is emerging is Smalltalk in the form of Pharo. If you have been casting asside OOP because of the way many mainstream languages do it then maybe you will like Smalltalk as a pure OOP form.
I just want more people in this shit and this community sure has some awesome programmers, so why not?
one of the leading dudes in CL is currently Eitaro Fukamachi, one dude...doing amazing things. My aim is to give him a hand.8
Do you guys think it’s time “Hackers” gets its 2020 remake? I know it was cheesy for its time (1995) but 8 year old me was INTO that music video montage direction and that movie inspired was what inspired me to get into tinkering with electronics/embedded systems.
Rewatching it tonight and the casting is so on point, too.5
GOD ALMIGHTY I HATE SWIFT & XCODE...
Why the fuck does it take a horrendous amount of time to muck about with layout constraints. Why the heck does xcode choose to add constraint layouts to elements that already have pissing constraints! Why does dealing with something as trivial as tables have to be so god damn fucking involved when HTML and CSS let me create and style tables in fuck all lines.
And what the hell is up with how pissing long xcode takes just to figure out that 1 extra line of code I've just added. You jump to another file and xcode finally decides to be an ide again and bitch at the fact that you've forgotten to add some parameter or that they've decided to rename paramter "x" since version fuck nows what.
Working with abstract classes is fun, lets use protocols (because interfaces are too old school) and then lets tack on something we call extensions and then lets make people piss about with convenience initializers.
And lord almighty, what the fuck is up with casting, what all this ?! BS. What's wrong with just checking if the value is null in the first place, or whats wrong with giving something an initial value, oh because having to unwrap shit is more elegant right??
And good god, I need to own a fucking cinema screen just to have the storyboard open, there's less fucking panels on the Sistine Chapel ceiling
then there is in xcode.1
I once made an oopsie in an API for a logistics provider (one of the biggest in Germany...).
To understand the oopsie...
Based on input data a string must be created containing several hex / string / formatted values.
Think of ...
$return .= sprintf("%02X", ...)
I think there were around 15 to 20 lines, although more complicated.
The bug happened because I had a brainfart.
What was previously one line with... Many many many many variables, I had to split into multiple lines since internal stuff changed and it was impossible to change this oneliner of hell with >50 formatting codes.
Of course we didn't test everything.
What we didn't test was - funnily enough - wether the casting was correct in all cases.
I misplaced a formatting code.
And we had a major brainfart because we tested integer, but not double / float values....
We sent for a long time packages much cheaper than allowed (took thw logistics provider nearly 3-4 months to realize this :) ).
Spot the difference:
print sprintf("%01.2s", $money).PHP_EOL;
print sprintf("%01.2f", $money).PHP_EOL;1
This is so far my worst Monday.
Ran to Emergency (A&E) because I was having breathing problems. Came back to work with Inhaler.
Work started with type casting and linker errors.
I hope the day ends well :(
The human in me knows casting a datetime to a decimal(20, 12) is fairly future-proof.
The dev in me is worried someone working at the same company in 273669 years will get mad at him.5
I've made a fun video transcribing one of the hot discussions on devRant: https://youtu.be/kL4TgNUS-9I
Please leave suggestions about what I should transcribe next in familiar format, also I wouldn't mind like and sharing! ;)3
Was recently asked if our team wanted to change from Java to Kotlin so I looked over the feature lists but don't see much that's impressive.
One argument was less boilerplate code but I think they're are libraries like Lomboq that can write that stuff for you.
The other was smart type casting and type inference and to that I'm like this sounds like giving monkeys a hammer.
Our JS codebase looks like shit... And our Java app just crashed in prod.
Getting a ton of text messages this morning and thankfully I'm on vacation still...
The error is not caused by NPE... but how some or logic spammed the db..
A new language isn't going to fix this.... And a team that writes this sort of shit logic clearly shows they are incapable of learning a new one probably...
They are already script kiddies... Don't need them to become babies...6
Data representation is one of the most important things in any kind of app you develop. The most common, classic way to do it is to create a class with all the fields you want to transport, for example User(name, lastName). It's simple and explicit, but hell no, in my current company we don't play that kindergarten bullshit, the only way we know how to do things here is full hardcore. Why would anyone write a class to represent a Song, a Playlist or an Album when you can just use a key-> value map for pretty much everything? Need a list of songs? No problem, use a List<Map<String, String>>, OBVIOUSLY each map is a song. Need a list of playlists? Use a List<List<Map<String, String>>>... Oh wait, need to treat a value as a number and all you have are strings? That's what casting is for, dumbass.
No, seriously, this company is great. I'm staying here forever!1
Achieving decent 2D collision detection using ray casting in unity is kinda hard. I have immense respect for gameplay programmers.
I'm almost there though...13
Generic arguments can't be cast. List<Dog> can't be cast to List<Animal>, because any methods that take Dog as an argument would suddenly have to work with an Animal (same works the other way round with return values).
But there are many situations where this would be okay. For instance, a Date can be cast to a String, so if we know that no method directly or indirectly accessible from a ListView<T> (including accessible property and field setters) will ever take an argument of type T, then ListView<Date> can be cast to a ListView<String>. Conversely, if we know that methods of StreamWriter will only ever take arguments of the generic type and interact in ways that don't change the object, then we can safely cast a StreamWriter<String> to a StreamWriter<Date>.
There could be a pair of generic constraints signifying that the type only crosses the interface boundary in one direction. I think this would be an interesting feature, but I don't know any strict type system that allows it. What do you think?25
"Choosing a typeface is an act of subtlety, like casting an actor: the best person to play a gardener is somebody who looks like they might belong outdoors — not somebody who is covered in flowers and shrubbery." - Josh Collinsworth2
PHP are you freaking kidding me right now? Why are you forcing me to write ugly and meaningless code like this?
Today I just learned that boolval("false") will return true.
I'd deffo expect this from casting operators, but not from a function which even has val inside of its name.
What purpose is to have functions like these in language if they just serve as plain wrapper for casting operators9
Plans for 2019 are to release two products.
1. A text-based strategy game engine that will act as the core of two or more progressive web applications, using Node.js/Express, EJS, and SCSS. It will be proprietary, subscription-based, and playable 24/7 online or offline as a web site or mobile app with nightly/weekly/monthly events and items (think KoL, on steroids, with butter on top.)
I am currently undecided whether to go with MongoDB, MySQL or PostgreSQL, so any feedback - without derailing the other choices, and understanding that it needs to be minimal at first with the ability to expand to millions of users - would be appreciated.
2. I'm sculpting collectors figurines of guinea pigs, molding, casting and then selling a limited set that are hand-painted by me with a certificate of authenticity, as well as marketing blank versions of each with a choice of three colors (including white, and either red or black for eyes - a total of five) for people to either paint by themselves, family members, or friends.
This will also have a website that allows you to choose the breed and colors (changing the picture according to your choices), as well as allowing people to use it as a social media outlet - as if their own guinea pigs had profiles instead of humans. It's also planned to support rescues worldwide and educate folks about properly caring for cavies.5
In last episode of "How SystemD screwed me over", we talked about Systemd's PrivateTMP and how it stopped me from generating SSL certificates.
In today's episode - SystemD vs CGroups!
Mister Pottering and his team apparently felt that CGroups are underused (As they can be quite difficult to set up), and so decided to integrate them into SystemD by default. As well as to provide a friendlier interface to control their values.
One can read about these interactions in the manual page "systemd.resource-control"
All is cool so far. So what happened to me today?
Imagine you did a major system release upgrade of a production server, previously tested on a standalone server. This upgrade doesn't only upgrade the distribution however, it also includes the switch from SysVInit to SystemD. Still, everything went smooth before, nothing to worry now then, right? Wrong.
The test server was never properly stress-tested. This would prove to be an issue.
When the upgrade finishes, it is 4 AM. I am happy to go to bed at last. At 6 AM, however, I am woken up again as the server's webservices are unavailable, and the machine is under 100% CPU load. Weird, I check htop and see that Apache now eats up all 32 virtual cores. So I restart it, casting it off to some weird bug or something as the load returns to normal.
2 hours later, however, the same situation occurs. This time, I scour all the logs I can, and find something weird - Many mentions that Apache couldn't create a worker thread? That's weird.
Several hours of research and tinkering later, I found out the following:
1 - By default, all processes of a system that runs SystemD are part of several CGroups. One of these CGroups is the PID CGroup, meant to stop a runaway process from exhausting all PIDs/TIDs of a system.
This limit is, by default, set to a certain amount of the total available PIDs. If a process exhausts this limit, it can no longer perform operations like fork().
So now, I know the how and why, but how should I solve this? The sanest option would be to get a rough estimate of just how many threads the Apache webserver might need. This option, though, is harder, than apparent. I cannot just take the MaxRequestsWorkers number... The instance has roughly double the amount of threads already. The cause being, as I found out, the HTTP/2 module, which spawns additional threads that do not count towards this limit. So I have no idea what limit to set.
Or I could... Disable the limit for just the webserver via the TasksAccounting switch. I thought this would work. And it did seem to... Until I ran out of TIDs again - Although systemctl status apache2.service no longer reported the number of tasks or a task limit of the process, the PID CGroup stayed set to the previous limit. Later I found out that I can only really disable the Task Accounting for all the units of a given slice and its parents.
This, though, systemctl somewhat didn't make apparent (And I skimmed the manual, that part was my fault)
So... The only remaining option I had was to... Just set the limit to infinite. And that worked, at last.
It took me several hours to debug this issue. And I once again feel like uninstalling systemd again, in favor of sysvinit.
What did I learn? RTFM, carefully, everything is important, it is not enough to read *half* the paragraph of a given configuration option...
Oh, and apache + http/2 = huge TID sink.
Casting never worked well with humans. On the other hand, programmers don't mind working with it.
Programmers != humans2
When the previous developer doesn't appear to know what casting is...
var foo = Convert.ToBoolean(objDictionary["someKey"].ToString());1
Now Casting: Designers, Engineers, Inventors and Makers! Calling all Designers, Engineers, Inventors and Makers! Intel, legendary Executive Producer Mark Burnett and MGM Television are looking for the most innovative makers to join Season 2 of America's Greatest Makers. Do you have an amazing idea for the next big smart connected device? Apply now for the chance to make your dream a reality using Intel's latest technology including the Intel Curie Module and upcoming advanced developer platforms that can connect to a broad array of input and output devices (including cameras and displays). Winner walks away with $1 million dollars! What will YOU make?
Could be fun
Is there any exact way to get the product of all primes under n multiplied together, without explicitly knowing what those primes are?
Lets call this number V.
Because hypothethetically, if we calculate from the *base* of V, then we can derive easy divisibility rules for V-1 and V+1, as laid out
And then, unless I've misunderstood something, the problem of factorization has been changed from division into an addition and subtraction problem.12
Python..... please cast my integers and such to string for me. I don't want to have to keep typing str().... pretty please?4
I spent three days looking for an error that caused my app to not displaying the layout (the app still was running but it was a black screen). On the third day, i discovered that when I register a SensorEventListener I have to cast the listener to SensorEventListener, otherwise it wont load, or even show errors on the logcat.
Some compilers give an error message on forgotten type casting. From that it shows good typing style casting. So you also avoid clerical errors that can lead to the program crash in the worst case. With some types it is also necessary to perform type casting comma on others Types, however, do this automatically for the compiler.
In short:Type casting is used to prevent mistakes.
An example of such an error would be:
int main ()
int * ptr = malloc (10*sizeof (int))+1;
By default, one tries to access the second element of the requested memory. However, this is not possible, since pointer calculation (+,-) does not work for a void pointer.
The improved example would be:
int * ptr = ((int *) malloc (10*sizeof (int)))+1;
Here, typecasting is done beforehand and this turns the void pointer into its int pointer and pointer calculation can be applied. Note: If instead of error "no output" is displayed on the sololearn C compiler try another compiler.1
"Choosing a typeface is an act of subtlety, like casting an actor: the best person to play a gardener is somebody who looks like they might belong outdoors — not somebody who is covered in flowers and shrubbery." - Josh Collinsworth
The bug: Some string values for an identifier property in the data objects are being sent from our frontend prefixed with a '0'. Sometimes. When it happens, it usually gets stripped away again by the time it's passed to our backend. But not always.
This 0 is never explicitly set anywhere. I even searched for a few variants of " = 0" in both the frontend and backend projects without receiving any results. You might already be suspecting where this is going.
So it turns out.
The data object which holds this value is being initialized in the aspnet (don't ask) backend and passed to the frontend, which then hydrates it. This value is always an integer number, albeit incidentally so which is why string is used as the actual type. When this object is initialized, it's hardcoded with an anonymous type where this property is set as int because I guess someone figured "it's always an int though". Being a typed language, primitive scalars can't be null objects which means the property's value becomes the concrete int 0.
Okay weird. I can think of better ways of doing this but let's just set it to string as I can't start overhauling things right now. Let's just go find where this value is somehow concatenated into the incoming parameter.
You see, this happens because at the point where the frontend sets this value, it may be an int or string depending on where it came from, and I guess someone figured that in order to cast it to string you just go prop += arg seeing as the prop is empty string and all. Because explicitly casting it or - as much as I get a rash whenever I see it - going prop = "" + arg would be too verbose and unoriginal.
Bonus round: How come the 0 only sometimes made it all the way to our backend? The thing is that this bug has been fixed before. The fix is that because this string is "always" an int, you can parse it to int before passing it to the backend in case it has leading zeroes. This path is only taken in certain views because someone forgot to copypaste their fix into all the places this is repeated.
Sometimes you find a bug and you are just somehow more grumpy after fixing it.1
I love JS. And then this things happen... I want to learn TypeScript so much (not really related as I don't know if it avoids this).
Btw, I ended up finding ++n works too, so in the end it was 'Question '+ ++n;7
After my trainig period in the new job (10 weeks), I joined a different department with very expirenced guys, one of them got my mentor, with him I was at my first plant (continues casting platn where next to me where thousands of kg molten steel) where we updated all controllers to a OS. From him I learned all the real life best practice stuff as well as the internal dev tools.
Without him I would not be able to be mentor to my new college now.
And also he became a friend
"So our price widget doesn't allow decimals, you'll have to create a custom widget"
I do it.
"Hey, It's not working and I verified it's applying the filter correctly. I noticed my price is a string in your index, maybe that's incorrect and causing it to not work?"
They say: "Yep, you'll need to run an update to fix that and change all to floats" (charges an arm and a leg for the thousands of index operations needed to update the data type)
I clear the index and send a single one as a test, verifying it's a float by casting it using (float) then var_dumping. It shows "double(3.99)", but when it gets to Algolia, it's 0.
So I contact support.
"Hi, I'm sending across floats like you say but it's receiving it as 0, am I doing something wrong? Here's my code and the result of the var_dump"
They respond: "Looks like you're doing it right, but our log shows us receiving 3.999399593939, maybe check your PHP.ini for "serialize_precision" and make sure it's set to -1"
I check and it's fine, then I realize that var_dump is probably rounding to 2 decimal points so I change my cast to (float) number_format($row['Price'], 2) and wallah...it works.
Now I've wasted days of paying for their service, a ton of charges for indexing operations, and it was such a simple fix.
if they had thrown an error for the infinite decimal, that would have helped, but instead I had to reach out to find out that was the issue.
Those of you working with .NET, do you prefer C# casting syntax:
Or VB casting syntax:
variable as Type;3
Last nite, one of my projects started crashing with a ClassCastException because it couldn't cast a string to a boolean, inside an if. This is Java. You can't even run a project if you evaluate a string inside an if. Has anyone seen such a thing before? I'm running BBQLinux which at least for me it has a lot of permissions issues and somehow things got so f'd up that it even messed up the Android image to a point that the compiler couldn't find a method to set a string into a TextView. I'm not kidding.2
"Choosing a typeface is an act of subtlety, like casting an actor: the best person to play a gardener is somebody who looks like they might belong outdoors — not somebody who is covered in flowers and shrubbery." - Josh Collinsworth
No matter how hard you try to stick magnet with a wood it just won’t work out in any way.
i hope its possible to change the wood into metal just like as easy as type-casting an integer into string, but it just won’t happen anyway~~2
Still working on this oldass project. Casting enums to different enums.. longass methods call another longass methods at the end...