[Solved] Delete all rows except the one with the biggest value

DELETE FROM `transactions` WHERE id NOT IN ( SELECT MAX(id) FROM `transactions` group by user_id ) The inner query groups by each user and select only the highest ID for each. Delete all records except the IDs from the inner select. 0 solved Delete all rows except the one with the biggest value

[Solved] How to use strtok in string?

The cause of the problem: The function strtok() has many problems, due to the fact that subsequent calls depend on previous calls, and this dependency is managed in an unsafe manner: it’s not thread safe (see Robert’s comment, and C++ standard section 21.8 pt 14) if one function you call would use strtok() without you … Read more

[Solved] How to make this c# code small or refactor this code [closed]

All your iterations can be joined together, therefore executed in one run like: ArrayList groupA = new ArrayList(); ArrayList groupB = new ArrayList(); ArrayList groupC = new ArrayList(); ArrayList groupD = new ArrayList(); ArrayList groupE = new ArrayList(); ArrayList groupF = new ArrayList(); ArrayList groupG = new ArrayList(); ArrayList groupH = new ArrayList(); for (int … Read more

[Solved] Why does this code hang on reaching the first ReadLine from a StreamReader?

I think you should return to basics: public static string SendXMLFile(string xmlFilepath, string uri, int timeout) { using (var client = new WebClient()) { client.Headers.Add(“Content-Type”, “application/xml”); byte[] response = client.UploadFile(uri, “POST”, xmlFilepath); return Encoding.ASCII.GetString(response); } } and see what works and what the server thinks of your file. When you really need a TimeOut then … Read more

[Solved] Codeigniter wrong url to redirect 404

Try this public function read($slug_posts) { $options = $this->options_model->listing(); $posts = $this->posts_model->read($slug_posts); if ( ! $posts) { show_404(); } #$listing = $this->posts_model->home(); $data = array( ‘title’ => $posts->post_title.’ – ‘.$options->option_title, ‘description’ => $posts->post_description, ‘posts’ => $posts, #’listing’ => $listing, ‘content’ => ‘posts/read’ ); $this->load->view(‘layout/wrapper’, $data, FALSE); } If truly understand what your question is, this … Read more

[Solved] java string to class and call mathod

First you have to know the name of the package containing the class. If you know it, you can try the following: String className = packageName + “.Test”; Class cls = Class.forName(className); cls.getMethod(“main”, String[].class).invoke(null); Note that, if the class is in (default) package then you can use “Test” as className without the package name. 2 … Read more

[Solved] compare two big strings with javascript [closed]

You can try to use MD5 hashes of long strings. MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of data. The generated hash is also non-reversable. Data cannot … Read more

[Solved] Optimize cube rendering in threejs

Finally, I get the solution! <script src=”https://cdnjs.cloudflare.com/ajax/libs/three.js/88/three.js”></script> <script> setTimeout(()=>{ s=1.5 k=[] onmousedown=()=>{document.body.requestPointerLock()} onmousemove=(e)=>{ if(document.pointerLockElement===document.body){ vector.xa-=0.01*e.movementX vector.ya-=0.01*e.movementY }} onkeydown=onkeyup=function(e){k[e.keyCode]=e.type==”keydown”} document.body.style.backgroundColor=”black” document.body.style.margin=”0″ scene=new THREE.Scene() camera=new THREE.PerspectiveCamera(75,1,0.1,16);vector={xs:0,ys:0,zs:0,xa:0,ya:0} camera.position.set(0,0,0);renderer=new THREE.WebGLRenderer() document.body.appendChild(renderer.domElement) light=new THREE.PointLight(“rgb(0,127,255)”,1,8);light.position.set(0,0,0);scene.add(light) function render(){ camera.aspect=window.innerWidth/window.innerHeight camera.updateProjectionMatrix() renderer.setSize(innerWidth,innerHeight) requestAnimationFrame(render) renderer.render(scene,camera) } setInterval(()=>{ if(vector.ya<-1){vector.ya=-1} if(1<vector.ya){vector.ya=1} if(k[37]){vector.xa+=0.1} if(k[38]){if(vector.ya<1.2){vector.ya+=0.1}} if(k[39]){vector.xa-=0.1} if(k[40]){if(-1.2<vector.ya){vector.ya-=0.1}} if(k[87]){vector.xs+=0.01*Math.sin(vector.xa)*Math.cos(vector.ya);vector.ys+=0.01*vector.ya;vector.zs+=0.01*Math.cos(vector.xa)*Math.cos(vector.ya)} if(k[83]){vector.xs-=0.01*Math.sin(vector.xa)*Math.cos(vector.ya);vector.ys-=0.01*vector.ya;vector.zs-=0.01*Math.cos(vector.xa)*Math.cos(vector.ya)} if(k[65]){vector.xs+=0.01*Math.sin(vector.xa+Math.PI/2)*Math.cos(vector.ya);vector.ys+=0.01*vector.ya;vector.zs+=0.01*Math.cos(vector.xa+Math.PI/2)*Math.cos(vector.ya)} if(k[68]){vector.xs+=0.01*Math.sin(vector.xa-Math.PI/2)*Math.cos(vector.ya);vector.ys+=0.01*vector.ya;vector.zs+=0.01*Math.cos(vector.xa-Math.PI/2)*Math.cos(vector.ya)} camera.position.x+=vector.xs;vector.xs=vector.xs*9/10 camera.position.y+=vector.ys;vector.ys=vector.ys*9/10 camera.position.z+=vector.zs;vector.zs=vector.zs*9/10 light.position.set(camera.position.x,camera.position.y,camera.position.z) camera.lookAt(new THREE.Vector3(camera.position.x+Math.sin(vector.xa)*Math.cos(vector.ya),camera.position.y+vector.ya,camera.position.z+Math.cos(vector.xa)*Math.cos(vector.ya))) if(s<Math.max(Math.pow(camera.position.x*camera.position.x,1/2),Math.pow(camera.position.y*camera.position.y,1/2),Math.pow(camera.position.z*camera.position.z,1/2))+12){sy=1.5 … Read more

[Solved] Send data to JS when PHP is told to do so

that would be done with Ajax or WEbSockets. WebSocket works by opening a connection channel between the server and users. you can find some websocket Examples Here: http://www.websocket.org/demos.html 1 solved Send data to JS when PHP is told to do so