ORDER BY clause is invalid

Uncategorized
Question: Error:The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified. The problem is I'm not using views. Any tips? SELECT fld_DeviceDescription , fld_DeviceModelName , fld_DeviceOrganizationName , fld_DeviceModelCode , CAST(DATEADD(MINUTE, fld_TZAM - (0) , fld_ConsDateTime) AS DATE) AS fld_ConstDate , SUM(fld_EnergyTotalIndexValue) AS fld_ConsumptionValue , MIN(fld_ConsDateTime) AS ConsStartDateTime , MAX(fld_ConsDateTime) AS Max_ConsEndDateTime FROM tbl_EM_DeviceEnergyHourlyConsumption WHERE fld_Deleted = 0 AND fld_Active = 1 AND fld_CalculationState = 2 AND fld_DeviceId IN (N'5') AND fld_ConsDateTime >= DATEADD(MINUTE, (-1*(fld_TZAM) + 0) , N'2017-07-16 00:00:00') AND fld_ConsDateTime < DATEADD(MINUTE, (-1*(fld_TZAM) + 0) , N'2017-08-15 00:00:00') AND fld_DeviceOrganizationId IN (SELECT Value FROM dbo.fn_OrganizationSubList(2) /* ~fld_ConsumptionPeriod~ ~fld_DeviceId~ ~fld_DateTime1~ ~fld_DateTime2~ */ GROUP BY CAST(DATEADD(MINUTE, (fld_TZAM + (0)* -1 ), fld_ConsDateTime) AS DATE) ,fld_DeviceDescription,…
Read More

How can make sound only play once in pygame?

Uncategorized
Question: When the user trigger a condition,I need to play a sound once.It is in major cycle of while,so it always play many times.Please solve the little problem.Thanks. Answer: Include at the start of your loop the code playsound = True. Then in your loop put the following:if playsound:# Play the sound playsound = False Put your current command for playing in place of # Play the sound, it probably looks something like sound.play(). Read more
Read More

MySQL: ID that has a pattern (primary key)

Uncategorized
Question: I want to have a userid that has a pattern. Instead of having an ID of 0, 1, 2.. etc, I want it something to be like ADM-001, ADM-002. What could be the best way to achieve this? I have absolutely no idea so I can't provide anything. I am also aware this is not a code writing site, but your suggestions would be appreciated. Thank you in advance. :( :) Answer: Don't mess with your PK data itself; that's not the purpose of PKs. You will kill performance and it will be a pain to manage. Just format it on the client, or in your select query:SELECT ('ADM' + LPAD(id, 3, '0')) formattedId FROM table; Read more
Read More

Eliminating Interferential Curve of Text in Images?

Uncategorized
Question: As you can see,I have an image of some formulas but it has some interferential curve,so how can I to remove it? I tried to erode and dilate but failed. Answer: You can remove those lines by using image inpainting. But need to make a mask first. Take a look at this- http://docs.opencv.org/trunk/df/d3d/tutorial_py_inpainting.html Erosion, Dilation might remove the dots in that image too. Read more
Read More

Using SASS – Structure Query [on hold]

Uncategorized
Question: So I recently started working with SASS/SCSS and so far I'm not having much trouble. As I'm new to working with this technology I had a couple of questions I was hoping someone had the answer to. Before I ask, Here is an example of a project layout I have setup: sass/ | |– base/ | |– _reset.scss # Reset/normalize | |– _typography.scss # Typography rules | ... # Etc… | |– components/ | |– _buttons.scss # Buttons | |– _carousel.scss # Carousel | |– _cover.scss # Cover | |– _dropdown.scss # Dropdown | |– _navigation.scss # Navigation | ... # Etc… | |– helpers/ | |– _variables.scss # Sass Variables | |– _functions.scss # Sass Functions | |– _mixins.scss # Sass Mixins | |– _helpers.scss # Class &…
Read More

SDL2: How to rotate Frame

Uncategorized
Question: I have an incoming frame that is in landscape but rotated 90 deg clockwise. I have tried a lot to correct t. I am using the following code height = 16 width = 9 SDL_RenderSetLogicalSize(renderer, width, height); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGB24, SDL_TEXTUREACCESS_STREAMING, width, height); SDL_UpdateTexture(texture, NULL, frame, pitch); SDL_RenderClear(renderer); SDL_RenderCopyEx(renderer, texture, NULL, NULL, 270, NULL, SDL_FLIP_NONE); SDL_RenderPresent(renderer); Various attempts to rotate endup in either the frame being mashed or cropped. Answer: Read more
Read More

NuGet package manager marks target platform as unsupported

Uncategorized
Question: I've created NuGet package from .Net Standard 1.3 library. Package definition in csproj file: My package My package description 1.0.0 Opensoft Inc. netstandard1.3; 1.3 .NETStandard v1.3 $(NoWarn);1591 true True TestAssembly 1.0.0.0 1.0.0.0 But after publishing package, I can't reference it correctly from .Net Framework 4.6.1 web application project. It says that target platform is unsupported. What am I doing wrong? Answer: .NET Standard 1.3 supports .NET Framework 4.6; not .NET Framework 4.6.1 Check the official documentation for supported versions. You need .NET Standard 1.4+ if you want to reference it from .NET Framework 4.6.1 Read more
Read More