Replace parts of a string based on pre/suffixes in Python

Uncategorized
Question: I'm creating a programming language with an interpreter that is written in Python. The syntax for my language looks like this:disp "The quick brown fox jumps over the lazy dog" # 'disp' displays text disp $myStr # anything starting with $ is a string variable strop add $myStr "... The End" # String operations. Concatenate $myStr and some text. However, I am having trouble parsing it. If I have the string "Hello, SO!" $myStr how do I separate it so that "Hello, SO!" and $myStr are separate, and make it work with two literals, two variables or one of each? Thanks in advance. Answer: Read more
Read More

Jquery animate is not working

Uncategorized
Question: I try my code but it is not working please check the following code: Document Click me This is a test peragraph Answer: That is because the position property of the p element is static and left won't work on static elements - change it to say relative and it works - see demo below: $(document).ready(function() { $("button").click(function() { $("p").animate({ left: '400px' }); }); }); p { width: 90px; background-color: #40FF08; position: relative; } Click me This is a test peragraph Read more
Read More

how do i create a save and reload game buttons for each activity that takes place

Uncategorized
Question: I am making a decision based game where the user picks a choice from a list after he has been asked a question. his answer would lead him to anoda activity with a question and a list view. and it goes on and on like that. but his score is accumulated as he progresses. please write me a code for a SAVE and RELOAD button so his progress can be reassumed when game is exited. thanks . note: on each activity; there is an image view,a textview and a list view. how do I save such pages. Answer: Read more
Read More

Error When Switching Tenant Using Apartment Gem

Uncategorized
Question: i am getting error when execute Apartment::Tenant.switch!("tenant_name") even when the tenant were exists. When i run Apartment::tenant_names,it return an array contain ["murah5","rahmatullah","test"] then i run Apartment::Tenant.switch!("murah5") it return : Apartment::TenantNotFound: One of the following schema(s) is invalid: "murah5" "public" from /Users/fourtyonestudio/.rvm/gems/ruby-2.4.1/gems/apartment-1.2.0/lib/apartment/adapters/postgresql_adapter.rb:72:inrescue in connect_to_new'` can you help me with this case ? Answer: Read more
Read More

Store every year directly from the date of entry of a user

Uncategorized
Question: Hi I need to store every year directly from the date of entry of a user to the business the problem is that every time I add a year is inserted between the day and month. var yearOnCompany = moment(user.fecha_ingreso_empresa, "YYYYMMDD").fromNow(); var dateStart = moment(user.fecha_ingreso_empresa).format("DD-MM-YYYY"); console.log(dateStart); //03-12-2009 var f = parseInt(yearOnCompany); var yearsOfWork = []; for(var i = 1; i
Read More

SQL transpose and groupby [duplicate]

mysql
Question: This question already has an answer here:MySQL pivot table 8 answers How to transpose by grouping the column time tag value 10 abc 67 11 abc 68 12 abc 65 10 cdf 23 11 cdf 24 12 cdf 25 to time abc cdf 10 67 23 11 68 24 12 65 25 Answer: This is a simple pivot query like this:SELECT time SUM(IF(tag='abc',value,NULL)) AS abc, SUM(IF(tag='cdf',value,NULL)) AS cdf FROM yourTable GROUP BY time I hope to be helpful for you :) Read more
Read More

JMeter add velocity language to JSR 223 Sampler

Uncategorized
Question: I want to use velocity language as Scripting language in JMeter's JSR 223 Sampler. According to the list velocity can be used in JSR223, According to the answer velocity should be added to JMeter classpath for discovery of available scripting engines. How can I add velocity as a Scripting engine in JMeter? Answer: Download new velocity engine scripting version 2.0 in order to support scripting engine. Put velocity-engine-scripting-2.0.jar in JMeter's lib folder. When JMeter loaded it can find velocity as scripting engine and use it. Read more
Read More

Change chart bars color in visual studio. C# Winforms

Uncategorized
Question: How to change those blue colors in design time? i found a method earlier but its only changing the color on the bars and not on the legend. This chart can show many data depending on the user so i need it to change color for all the data. Thank you code:private void loadchartFast() { chart1.Series[0].Points.Clear(); chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1; using (SqlConnection connection = new SqlConnection("Data Source=BENJOPC\SQLEXPRESS;Initial Catalog=MARISCHELLdatabase;Integrated Security=True")) { SqlCommand command = new SqlCommand("SELECT TOP 5 ProductName, Sum(QtySold) as QtySold FROM Sales_productholder group by ProductName order by SUM(QtySold) desc", connection); //top selling with desc connection.Open(); SqlDataReader read = command.ExecuteReader(); while (read.Read()) { this.chart1.Series["Pieces Sold"].Points.AddXY(read["ProductName"], read["QtySold"]); } read.Close(); // chart3.Series["Pieces Sold"].Points[0].Color = Color.LightSeaGreen; ; } } Answer: You can use Palette property to have different colors: Select any of the…
Read More

How do we select data based on month and year in oracle query

Uncategorized
Question: I have did my research and I found that it can be done in MSQL with SELECT * FROM sales WHERE month(sellDate) = 3 AND YEAR(sellDate) = 2017 But when I tried with Oracle , It returns me ORA-00904: "YEAR": invalid identifier Is there any Way I could call data based on month and year in oracle query ? Solved Thank you so much , I have also came out with a solution This is how I did it .. :) select * from sales where to_char(sell,'MM')='09' AND to_char(sell,'YYYY')='2018'; Answer: You can use EXTRACT to get month and year from date. For Example SELECT Extract(YEAR FROM CURRENT_DATE), EXTRACT(MONTH FROM CURRENT_DATE) FROM dual; It will generate result as below. So the query you posted in question can be re-written as…
Read More

ClipperLib non-intersecting polygons giving unexpected result

Uncategorized
Question: I'm trying to add server collision detection on my 2D game by using ClipperLib (also being used on client). However, when trying to get the clipping between my terrain and a circle, it produces a weird result via the Clipper.Execute method: The images of the terrain, circle and result paths can be found here: http://imgur.com/a/gM8e9 I am using each point on the paths to draw an image where the background is black and each point on the path is a white dot. The terrain path and circle path seem to be accurate, however, the result isn't. Reproducible code:import de.lighti.clipper.Clipper; import de.lighti.clipper.DefaultClipper; import de.lighti.clipper.Point; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; public final class ClipperTest { private…
Read More