Hacer una aplicación ligera en BlackBerry Browserfield -- java campo con mobile camp codereview Relacionados El problema

Making a lightweight app in BlackBerry Browserfield


5
vote

problema

Español

Esta es una aplicación hecha por mí para mostrar una página web en BlackBerry y para agregar algunas funciones más como verificar la conectividad de la red mientras se apertura de la aplicación, cargando alguna URL en el navegador en lugar de la aplicación, haciendo una pantalla de salpicadura y cargando animación.

El problema con el código es que cuando ejecuto esta aplicación en BlackBerry dispositivo, después de un tiempo, dice "Memoria baja en el dispositivo. Por favor, cierra alguna aplicación" y esto cerrará mi aplicación. Entiendo que este es un problema de Browserfield como se muestra en este hilo . Sin embargo, deseo hacer este código ligero. Esto significa que ninguna de las características anteriores debe comprometerse, pero la cantidad de memoria necesaria por la aplicación debe reducirse para que la aplicación no consuma esa cantidad de memoria que debía cerrarse. Creo que los detalles anteriores son suficientes tal vez. Estoy listo para dar más detalles según lo formulado. Toda esta aplicación fue diseñada por mí utilizando BlackBerry Eclipse Plugin.

¿Puede alguien revisar esto y sugerir formas de hacerlo ligero?

myapp.java

  public class MyApp extends UiApplication {  public static void main(String[] args) { // Create a new instance of the application and make the currently // running thread the application's event dispatch thread. MyApp theApp = new MyApp();        theApp.enterEventDispatcher(); }    public MyApp() {         // Push a screen onto the UI stack for rendering. extracted();  pushScreen(new SplashScreen()); }  private void extracted() { new      ApplicationPermissions().addPermission(ApplicationPermissions.PERMISSION_INTERNET); } }   

mysscreen.java

  public final class MyScreen extends MainScreen  {  protected static boolean pageLoaded = false; private BrowserField browserField; private VerticalFieldManager mainManager; private String targetURL = "http://reelafrica.net";   public MyScreen()  { createGUI();  }  private void createGUI()  {  mainManager = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT | Manager.VERTICAL_SCROLLBAR | Manager.HORIZONTAL_SCROLLBAR ); browserField = new BrowserField(); browserField = createBrowserField();  mainManager.add(browserField);  add(mainManager);   }  private boolean checkURL(String mURL) {   if(mURL.endsWith("?ultima"))      return true; return false;  } private BrowserField createBrowserField()  {         boolean a= CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT);      if(a==false)      {         UiApplication.getUiApplication().invokeLater(new Runnable() {              public void run() {                 Dialog.alert("No Internet Connectivity");                    System.exit(0);             }         });       }      else{ PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {      public void run() {         }     });      }  browserField.getConfig(); browserField.requestContent(targetURL); ProtocolController controller = new ProtocolController(browserField) {     public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {           PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {              public void run() {               }         });           String x = request.getURL();            if(checkURL(x))            {            BrowserSession b = Browser.getDefaultSession();            b.displayPage(request.getURL());               }         InputConnection inputConnection = handleResourceRequest(request);       browserField.displayContent(inputConnection, request.getURL());       } };  browserField.getConfig().setProperty(BrowserFieldConfig.CONTROLLER, controller);  browserField.addListener(new BrowserFieldListener() {       public void downloadProgress(BrowserField browserField,ContentReadEvent event) throws Exception {                  super.downloadProgress(browserField, event);          Application.getApplication().invokeLater( new Runnable()          {             public void run()              {             }         });     }      public void documentLoaded(BrowserField browserField,Document document) throws Exception {         super.documentLoaded(browserField, document);         pageLoaded = true;     } });  return browserField; }   }   

por favor kaitpopupscreen.java

  public class PleaseWaitPopupScreen extends PopupScreen {  Background bg = BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0); Border border=BorderFactory.createRoundedBorder(new XYEdges(5,5,5,5),Color.WHITE,Border.STYLE_TRANSPARENT); private AnimatedGIFField _ourAnimation = null;  private PleaseWaitPopupScreen() { super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL |  VerticalFieldManager.VERTICAL_SCROLLBAR)); GIFEncodedImage ourAnimation = (GIFEncodedImage) GIFEncodedImage.getEncodedImageResource("cycle.agif"); _ourAnimation = new AnimatedGIFField(ourAnimation, Field.FIELD_HCENTER); this.add(_ourAnimation); this. setBackground(bg); this.setBorder(border);  }   public static void showScreenAndWait(final Runnable runThis) { final PleaseWaitPopupScreen thisScreen = new PleaseWaitPopupScreen(); Thread threadToRun = new Thread() { public void run() {     // First, display this screen     UiApplication.getUiApplication().invokeLater(new Runnable() {         public void run() {             UiApplication.getUiApplication().pushScreen(thisScreen);         }     });     boolean mTest = true;     while(mTest)     {     if(MyScreen.pageLoaded){         mTest = false;         MyScreen.pageLoaded = false;      UiApplication.getUiApplication().invokeLater(new Runnable() {         public void run() {             UiApplication.getUiApplication().popScreen(thisScreen);         }     });     } } } }; threadToRun.start();  }  }   

splashscreen.java

  public final class SplashScreen extends MainScreen { public SplashScreen() { super(); this.setTitle("loading..."); Bitmap obj = Bitmap.getBitmapResource("splashscreen480x360.png"); BitmapField headerLogoField = new BitmapField(obj, BitmapField.HFULL | Field.FIELD_HCENTER); setTitle(headerLogoField); add (new BitmapField(obj)); // add you splash screen images or whatever here  final SplashScreen me = this; new Thread(){ public void run() {     // do something that takes a long time     try { Thread.sleep(1000);} catch (Exception e) {}      synchronized (UiApplication.getEventLock()) {         Screen next = new MyScreen(); // replace with your next screen here         UiApplication.getUiApplication().pushScreen(next);         UiApplication.getUiApplication().popScreen(me);     } } }.start(); } }   

animatedgiffield.java

  public class AnimatedGIFField extends BitmapField  { private GIFEncodedImage _image;     //The image to draw. private int _currentFrame;          //The current frame in the animation sequence. private AnimatorThread _animatorThread;  public AnimatedGIFField(GIFEncodedImage image) { this(image, 0); }  public AnimatedGIFField(GIFEncodedImage image, long style) { //Call super to setup the field with the specified style. //The image is passed in as well for the field to configure its required size. super(image.getBitmap(), style);  //Store the image and it's dimensions. _image = image;  //Start the animation thread. _animatorThread = new AnimatorThread(this); _animatorThread.start(); }  protected void paint(Graphics graphics) { //Call super.paint.  This will draw the first background frame and handle any required focus drawing. super.paint(graphics); //Don't redraw the background if this is the first frame. if (_currentFrame != 0) { //Draw the animation frame. graphics.drawImage(_image.getFrameLeft(_currentFrame), _image.getFrameTop(_currentFrame),      _image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0); } }  //Stop the animation thread when the screen the field is on is //popped off of the display stack. protected void onUndisplay() { _animatorThread.stop(); super.onUndisplay(); }   //A thread to handle the animation. private class AnimatorThread extends Thread { private AnimatedGIFField _theField; private boolean _keepGoing = true;       private int _totalFrames;               //The total number of frames in the image. private int _loopCount;                 //The number of times the animation has looped (completed). private int _totalLoops;                //The number of times the animation should     loop (set in the image).  public AnimatorThread(AnimatedGIFField theField) { _theField = theField; _totalFrames = _image.getFrameCount(); _totalLoops = _image.getIterations();  }  public synchronized void stop() { _keepGoing = false; }  public void run() { while(_keepGoing) {     //Invalidate the field so that it is redrawn.     UiApplication.getUiApplication().invokeAndWait(new Runnable()      {         public void run()          {             _theField.invalidate();                             }     });                      try     {         //Sleep for the current frame delay before the next frame is drawn.         sleep(_image.getFrameDelay(_currentFrame) * 10);     }     catch (InterruptedException iex)     {} //Couldn't sleep.      //Increment the frame.     ++_currentFrame;            if (_currentFrame == _totalFrames)     {         //Reset back to frame 0 if we have reached the end.         _currentFrame = 0;          ++_loopCount;          //Check if the animation should continue.         if (_loopCount == _totalLoops)         {             _keepGoing = false;         }     } } } } }   
Original en ingles

This is an app made by me to display a web page on blackberry and to add some more features like checking network connectivity while opening app, loading some URL in browser rather than app, making a splash screen and loading animation.

The problem with the code is that when I run this app on blackberry device it after some time says "low memory on device. Please close some app" and this will close my app. I understand that this is a problem of browserfield as shown in this thread. However I wish to make this code lightweight. This means none of the above features need to be compromised, but the amount of memory needed by the app need to be reduced so that app does not consume that much memory that it needed to be closed. I think above details are sufficient perhaps. I am ready to give further details as asked. this whole app was designed by me using Blackberry Eclipse plugin.

Can someone review this and suggest ways of making it lightweight?

MyApp.java

public class MyApp extends UiApplication {  public static void main(String[] args) { // Create a new instance of the application and make the currently // running thread the application's event dispatch thread. MyApp theApp = new MyApp();        theApp.enterEventDispatcher(); }    public MyApp() {         // Push a screen onto the UI stack for rendering. extracted();  pushScreen(new SplashScreen()); }  private void extracted() { new      ApplicationPermissions().addPermission(ApplicationPermissions.PERMISSION_INTERNET); } } 

MyScreen.java

public final class MyScreen extends MainScreen  {  protected static boolean pageLoaded = false; private BrowserField browserField; private VerticalFieldManager mainManager; private String targetURL = "http://reelafrica.net";   public MyScreen()  { createGUI();  }  private void createGUI()  {  mainManager = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT | Manager.VERTICAL_SCROLLBAR | Manager.HORIZONTAL_SCROLLBAR ); browserField = new BrowserField(); browserField = createBrowserField();  mainManager.add(browserField);  add(mainManager);   }  private boolean checkURL(String mURL) {   if(mURL.endsWith("?ultima"))      return true; return false;  } private BrowserField createBrowserField()  {         boolean a= CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT);      if(a==false)      {         UiApplication.getUiApplication().invokeLater(new Runnable() {              public void run() {                 Dialog.alert("No Internet Connectivity");                    System.exit(0);             }         });       }      else{ PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {      public void run() {         }     });      }  browserField.getConfig(); browserField.requestContent(targetURL); ProtocolController controller = new ProtocolController(browserField) {     public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {           PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {              public void run() {               }         });           String x = request.getURL();            if(checkURL(x))            {            BrowserSession b = Browser.getDefaultSession();            b.displayPage(request.getURL());               }         InputConnection inputConnection = handleResourceRequest(request);       browserField.displayContent(inputConnection, request.getURL());       } };  browserField.getConfig().setProperty(BrowserFieldConfig.CONTROLLER, controller);  browserField.addListener(new BrowserFieldListener() {       public void downloadProgress(BrowserField browserField,ContentReadEvent event) throws Exception {                  super.downloadProgress(browserField, event);          Application.getApplication().invokeLater( new Runnable()          {             public void run()              {             }         });     }      public void documentLoaded(BrowserField browserField,Document document) throws Exception {         super.documentLoaded(browserField, document);         pageLoaded = true;     } });  return browserField; }   } 

PleaseWaitPopupScreen.java

public class PleaseWaitPopupScreen extends PopupScreen {  Background bg = BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0); Border border=BorderFactory.createRoundedBorder(new XYEdges(5,5,5,5),Color.WHITE,Border.STYLE_TRANSPARENT); private AnimatedGIFField _ourAnimation = null;  private PleaseWaitPopupScreen() { super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL |  VerticalFieldManager.VERTICAL_SCROLLBAR)); GIFEncodedImage ourAnimation = (GIFEncodedImage) GIFEncodedImage.getEncodedImageResource("cycle.agif"); _ourAnimation = new AnimatedGIFField(ourAnimation, Field.FIELD_HCENTER); this.add(_ourAnimation); this. setBackground(bg); this.setBorder(border);  }   public static void showScreenAndWait(final Runnable runThis) { final PleaseWaitPopupScreen thisScreen = new PleaseWaitPopupScreen(); Thread threadToRun = new Thread() { public void run() {     // First, display this screen     UiApplication.getUiApplication().invokeLater(new Runnable() {         public void run() {             UiApplication.getUiApplication().pushScreen(thisScreen);         }     });     boolean mTest = true;     while(mTest)     {     if(MyScreen.pageLoaded){         mTest = false;         MyScreen.pageLoaded = false;      UiApplication.getUiApplication().invokeLater(new Runnable() {         public void run() {             UiApplication.getUiApplication().popScreen(thisScreen);         }     });     } } } }; threadToRun.start();  }  } 

SplashScreen.java

public final class SplashScreen extends MainScreen { public SplashScreen() { super(); this.setTitle("loading..."); Bitmap obj = Bitmap.getBitmapResource("splashscreen480x360.png"); BitmapField headerLogoField = new BitmapField(obj, BitmapField.HFULL | Field.FIELD_HCENTER); setTitle(headerLogoField); add (new BitmapField(obj)); // add you splash screen images or whatever here  final SplashScreen me = this; new Thread(){ public void run() {     // do something that takes a long time     try { Thread.sleep(1000);} catch (Exception e) {}      synchronized (UiApplication.getEventLock()) {         Screen next = new MyScreen(); // replace with your next screen here         UiApplication.getUiApplication().pushScreen(next);         UiApplication.getUiApplication().popScreen(me);     } } }.start(); } } 

AnimatedGIFField.java

public class AnimatedGIFField extends BitmapField  { private GIFEncodedImage _image;     //The image to draw. private int _currentFrame;          //The current frame in the animation sequence. private AnimatorThread _animatorThread;  public AnimatedGIFField(GIFEncodedImage image) { this(image, 0); }  public AnimatedGIFField(GIFEncodedImage image, long style) { //Call super to setup the field with the specified style. //The image is passed in as well for the field to configure its required size. super(image.getBitmap(), style);  //Store the image and it's dimensions. _image = image;  //Start the animation thread. _animatorThread = new AnimatorThread(this); _animatorThread.start(); }  protected void paint(Graphics graphics) { //Call super.paint.  This will draw the first background frame and handle any required focus drawing. super.paint(graphics); //Don't redraw the background if this is the first frame. if (_currentFrame != 0) { //Draw the animation frame. graphics.drawImage(_image.getFrameLeft(_currentFrame), _image.getFrameTop(_currentFrame),      _image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0); } }  //Stop the animation thread when the screen the field is on is //popped off of the display stack. protected void onUndisplay() { _animatorThread.stop(); super.onUndisplay(); }   //A thread to handle the animation. private class AnimatorThread extends Thread { private AnimatedGIFField _theField; private boolean _keepGoing = true;       private int _totalFrames;               //The total number of frames in the image. private int _loopCount;                 //The number of times the animation has looped (completed). private int _totalLoops;                //The number of times the animation should     loop (set in the image).  public AnimatorThread(AnimatedGIFField theField) { _theField = theField; _totalFrames = _image.getFrameCount(); _totalLoops = _image.getIterations();  }  public synchronized void stop() { _keepGoing = false; }  public void run() { while(_keepGoing) {     //Invalidate the field so that it is redrawn.     UiApplication.getUiApplication().invokeAndWait(new Runnable()      {         public void run()          {             _theField.invalidate();                             }     });                      try     {         //Sleep for the current frame delay before the next frame is drawn.         sleep(_image.getFrameDelay(_currentFrame) * 10);     }     catch (InterruptedException iex)     {} //Couldn't sleep.      //Increment the frame.     ++_currentFrame;            if (_currentFrame == _totalFrames)     {         //Reset back to frame 0 if we have reached the end.         _currentFrame = 0;          ++_loopCount;          //Check if the animation should continue.         if (_loopCount == _totalLoops)         {             _keepGoing = false;         }     } } } } } 
     

Lista de respuestas

5
 
vote

Debes arreglar tu sangría. Quiero revisar el código, pero la falta de sangría hace que sea realmente difícil de leer.

Usted usa Eclipse, así que use esto para formatear su código:

CTRL + Shift + f

o, en el menú principal & gt; Fuente y gt; Formato


Aparte de eso, hay un par de cosas pequeñas que veo:

  private int _totalFrames;               //The total number of frames in the image. private int _loopCount;                 //The number of times the animation has looped (completed). private int _totalLoops;                //The number of times the animation should     loop (set in the image).   

Estás sangrando tus comentarios.

Para mí, esto es una mala práctica. He sido mordido por ello antes;

Alguien escribe una larga línea de código ...

  public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed!   

y se pierde las cosas importantes porque se pierde el último bit del comentario debido a los desafortunados finales de la oración.

No hinche sus comentarios, y si tiene un comentario largo, póngalo en una línea separada. Recomiendo ponerlo antes del código, ahí es donde los bloques de comentarios de Javadoc se van de todos modos.


Usted pone espacios después de las variables.

específicamente,

  add (new BitmapField(obj));   

y

  this. setBackground(bg);   

. Para mí, estos interrumpen mi capacidad para identificar lo que significa una palabra. Un espacio actúa como un separador de "cosas" para mí. Y si pones un espacio entre un nombre de función y los argumentos, entonces tengo que leerlo dos veces para entender lo que está pasando.

 

You should fix your indentation. I want to review the code, but a lack of indentation makes it really hard to read it.

You use Eclipse, so use this to format your code:

Ctrl + Shift + F

Or, in the main menu > Source > Format


Aside from that, there's a couple small things I see:

private int _totalFrames;               //The total number of frames in the image. private int _loopCount;                 //The number of times the animation has looped (completed). private int _totalLoops;                //The number of times the animation should     loop (set in the image). 

You're indenting your comments.

To me, this is bad practice. I've been bitten by it before;

Someone writes a long line of code...

public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 

And you miss the important stuff because you miss the last bit of the comment due to unfortunate sentence endings.

Don't indent your comments, and if you have a long comment put it on a separate line. I recommend putting it before the code, that's where javadoc comment blocks go anyway.


You put spaces after variables.

Specifically,

add (new BitmapField(obj)); 

and

this. setBackground(bg); 

. To me, these disrupt my ability to identify what a word means. A space acts as a separator of "things" to me. And if you put a space between a function name and the arguments then I have to read it twice to understand what's going on.

 
 
 
 
3
 
vote

MyApp

El nombre de este método no parece reflejar lo que hace:

  private void extracted() {     new      ApplicationPermissions().addPermission(ApplicationPermissions.PERMISSION_INTERNET); }   

En realidad no entiendo lo que hace en absoluto. ¿Por qué crear un objeto, llame a un método y luego tíralo?

¿Cambiará su programa si elimina esta parte? Si no, entonces deberías eliminarlo. Si es así, entonces deberías agregar un comentario, Porque este código no habla por sí mismo, desafortunadamente.

MyScreen

nombres como MyScreen están bien en los programas de prueba de lanzamiento que escribe mientras aprenden un idioma. A medida que su programa está empezando a tener algo de forma y complejidad (lo que sí lo hace), y definitivamente antes de compartir con otros para su revisión, Deberías darle un mejor nombre. El nombre debe dar una buena idea al lector de qué se trata la clase, Así que puedo adivinar cuáles deben ser sus responsabilidades.


¿Hay una buena razón para esto?

  browserField = new BrowserField(); browserField = createBrowserField();   

El significado de la primera declaración: Crear un BrowserField

.

El significado de la segunda declaración: Crear un public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 0 ? Uhm, ¿qué?

También veo que public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 1 no se usa dentro de esta clase nuevamente: Después de que se crea, lo agregas a public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 2 , y el no se hace referencia de nuevo.

Cuando no necesita una variable como miembro de clase, Debe usar una variable local en su lugar. Lo mismo ocurre con public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 3 también por cierto.

De esta manera habría sido mejor:

  public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 4  

Puede devolver las expresiones booleanas directamente, no es necesario envolverlas con un public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 5 . Por ejemplo, en lugar de esto:

  public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 6  

puedes escribir:

  public static Object spliceIndex(List<Object> objects, int index){//Removes object from list. IMPORTANT: This function is 1-indexed! 7  

Más ...

Sólo raye la superficie. Hay mucho más que revisar aquí, Y con suerte, para usted, otros revisores lo quiten.

Optimice sus programas para Tiempo de lectura Conveniencia en lugar de Tiempo de escritura Conveniencia. Casi todo el código se lee más de lo que está escrito. Incluso si (piensas) lo escribes solo por ti mismo. A juzgar por las estadísticas de la página, esta pregunta se leyó 66 veces cuando escribo esto.

No ha recibido respuestas desde el 22 de julio porque esto es muy difícil de leer. Si se hubiera tomado el tiempo para escribirlo de una manera que usted mismo puede leerlo más fácil, Ya habría sido de mayor calidad (estoy seguro de ello), Y habrías recibido muchas más, y respuestas constructivas.

LÍNEA INFERIOR: Favorecer la comodidad de tiempo de lectura. Revise su código primero antes de publicar aquí. Aplique la resolución de problemas de goma pato técnica, funciona.

 

MyApp

The name of this method doesn't seem to reflect what it does:

private void extracted() {     new      ApplicationPermissions().addPermission(ApplicationPermissions.PERMISSION_INTERNET); } 

Actually I don't get what it does at all. Why create an object, call a method on it and then throw it away?

Will your program change if you delete this part? If not then you should delete it. If yes then you should add a comment, because this code doesn't speak for itself, unfortunately.

MyScreen

Names like MyScreen are OK in throw-away test programs you write while learning a language. As your program is starting to have some shape and complexity (which yours certainly does), and definitely before sharing with others for review, you should give it a better name. The name should give a good idea to the reader what the class is about, so I can guess what its responsibilities should be.


Is there a good reason for this?

browserField = new BrowserField(); browserField = createBrowserField(); 

The meaning of the first statement: create a BrowserField.

The meaning of the second statement: create a BrowserField? Uhm, what?

I also see that browserField is not used inside this class again: after it's created, you add it to mainManager, and the it's not referenced again.

When you don't need a variable as a class member, you should use a local variable instead. The same goes for mainManager too by the way.

This way would have been better:

private void createGUI() {     BrowserField browserField = createBrowserField();     VerticalFieldManager mainManager = ....     mainManager.add(browserField);     add(mainManager); }  private BrowserField createBrowserField() {     BrowserField browserField = new BrowserField();      // ... initialize / configure browserField as you did     return browserField; } 

You can return boolean expressions directly, no need to wrap them with an if. For example, instead of this:

private boolean checkURL(String mURL) {     if (mURL.endsWith("?ultima"))         return true;     return false; } 

You can write:

private boolean checkURL(String mURL) {     return mURL.endsWith("?ultima"); } 

More...

I only scratched the surface. There is so much more to review here, and hopefully for you, other reviewers will chip it.

Optimize your programs for read-time convenience as opposed to write-time convenience. Almost all code gets read more than it is written. Even if (you think) you write it only for yourself. Judging by the page stats, this question was read 66 times when I write this.

You haven't received answers since July 22 because this is very hard to read. If you had taken the time to write it in a way that you yourself can read it easier, it would have already been higher quality (I'm sure of it), and you would have received far more, and constructive answers.

Bottom line: favor read-time convenience. Review your code yourself first before posting here. Apply the Rubber Duck Problem Solving technique, it does work.

 
 

Relacionados problema

2  Utilice los componentes de VUE como una sola vez en el andamio de diseño  ( Use vue components as one offs in layout scaffolding ) 
He estado recibiendo recientemente en VUEJS y CSS Grid. En el pasado, siempre he usado marcos como Bootstrap para construir mi diseño. Sin embargo, ya que las...

1  Creación de hilos dinámicos para una API de texto SMS  ( Creating dynamic threads for a sms text api ) 
Primero, quiero decir que este código funciona, pero quiero asegurarme de que esta es la forma correcta de hacerlo. Estoy escribiendo esto para una API de tex...

1  Menús de navegación en pruebas de automatización  ( Navigating menus in automation tests ) 
Estoy tratando de escribir un método que pueda encontrar el elemento secundario en un menú. El siguiente código funciona pero no es exactamente elegante o esc...

12  Bratwurst.py - un programa de ayuda para un cajero  ( Bratwurst py a helper program for a cashier ) 
Soy un estudiante en Alemania, más específicamente en Bavaria, y aquí usamos para tener un llamado "Kirwa" , un evento para celebrar el establecimiento de la...

2  Verificación del agente de usuario móvil  ( Mobile user agent check ) 
He estado usando la siguiente expresión regular del agente de usuario para detectar dispositivos móviles, pero recientemente me encontré con algunos recursos ...

2  Control deslizante de imagen receptivo  ( Responsive image slider ) 
He estado haciendo algunas clases de códigos en JQuery, y necesitaba un control deslizante de imagen para mi sitio. En este momento, solo hay dos estados rece...

3  Mejora de la aplicación PhoneGap / JavaScript  ( Improving phonegap javascript application ) 
Tengo una aplicación PhoneGap que escribí hace algún tiempo. Después de mirar el seminario de video de Doug Crockford javascript: las buenas partes . Me ...

2  Ocultar / mostrar barra lateral  ( Hide show sidebar ) 
Estoy usando este código para mi diseño de la barra lateral móvil de diseño / espectáculo. No soy un experto en JQERY y solo me pregunto si puedo optimizar es...

1  ¿Es correcta esta implementación de las ECIE CIPHER?  ( Is this implementation of the ecies cipher correct ) 
He descargado Código fuente de Cryptosms e implementé el Ecies cifre en mi trabajo para Java Mobile. Dudo que la validez de este paso (el código complet...

0  MENÚ RESPONSIVO DE LA IZQUIERDA FONDIR  ( Responsive left fly out menu ) 
Estoy trabajando en este sitio web Actualmente. Si cambia el tamaño de la ventana a menos de 650px, el menú principal se reemplaza por un botón que cuando...




© 2022 respuesta.top Reservados todos los derechos. Centro de preguntas y respuestas reservados todos los derechos