logo
down
shadow

java code with files work from eclipse but dont work from cmd


java code with files work from eclipse but dont work from cmd

By : user2188055
Date : November 29 2020, 04:01 AM
I wish this helpful for you try passing the full path like c:\myfolder\src and then see what you get. May be where you are running the src folder is not the correct relative path.
code :


Share : facebook icon twitter icon
CSS dont work on browsers, but it does on Eclipse

CSS dont work on browsers, but it does on Eclipse


By : Chet Lemon
Date : March 29 2020, 07:55 AM
wish help you to fix your issue You need to learn how relative URLs work. The relative URL of the CSS file
code :
<link rel="stylesheet" type="text/css" href="/css/masterTemplateCSS/masterTemplateCSS.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/css/masterTemplateCSS/masterTemplateCSS.css" />
JAVA ANDROID:Reading Php Json values, Eclipse dont see the error but it doesnt work

JAVA ANDROID:Reading Php Json values, Eclipse dont see the error but it doesnt work


By : ansu
Date : March 29 2020, 07:55 AM
I wish this helpful for you You cannot run network operation on the main thread.
Use asyncTask instead.
code :
public class JSONExampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        new GetSmsTask().execute("http://iatek.eu/sys/getsms.php");
       }   

    private class GetSmsTask extends AsyncTask<String, Void, JSONObject> {
     protected JSONObject doInBackground(String... urls) {
     JSONObject obj = null;
     try{
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(url[0]);
            HttpResponse response = httpclient.execute(httppost);           
            String jsonResult = inputStreamToString(response.getEntity()
                                                   .getContent()).toString();                      
            obj = new JSONObject(jsonResult);
        } 
        catch (JSONException e) {
            e.printStackTrace();
        } 
        catch (ClientProtocolException e) {
            e.printStackTrace();
        } 
        catch (IOException e) {
            e.printStackTrace();
        }

        return obj;
     }

     protected void onPostExecute(JSONObject obj) {
      JSONArray jsonArray = obj.getJSONArray("posts");

       JSONObject childJSONObject = jsonArray.getJSONObject(3);
         String username = childJSONObject.getString("username");
         String sms = childJSONObject.getString("sms");
         String fcat = childJSONObject.getString("fcat");
         textView.setText(""+sms+"--" + username);
     }
 }

}
String jsonResult = inputStreamToString(response.getEntity()
                     .getContent()).toString(); 
String jsonResult = "{\"posts\":" +
    "[{\"cid\":\"11\",\"username\":\"Livi\",\"sms\":\"ag\",\"fto\":\"\",\"fcat\":\"cat\"}," +
    " {\"cid\":\"11\",\"username\":\"Livi\",\"sms\":\"ag\",\"fto\":\"\",\"fcat\":\"cat\"}, " +
    "{\"cid\":\"11\",\"username\":\"Livi\",\"sms\":\"ag\",\"fto\":\"\",\"fcat\":\"cat\"}," +
    "{\"cid\":\"11\",\"username\":\"Livi\",\"sms\":\"ag\",\"fto\":\"\",\"fcat\":\"cat\"}]}";
Adb am command work, but the intent in java code dont work

Adb am command work, but the intent in java code dont work


By : Giovanni De Angelis
Date : March 29 2020, 07:55 AM
it helps some times sorry for my english, and need a little help
code :
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setComponent(new ComponentName("net.openvpn.openvpn","net.openvpn.openvpn.OpenVPNAttachmentReceiver"));
        intent.setDataAndType(Uri.parse(file_path), "application/x-openvpn-profile");
        startActivity(intent);
dr.Read() dont execute my ELSE code block when the work is on HOLD and i cant find how i add EndTime for HOLDED work

dr.Read() dont execute my ELSE code block when the work is on HOLD and i cant find how i add EndTime for HOLDED work


By : Álex Gama
Date : March 29 2020, 07:55 AM
I hope this helps you . **I made it like this and it worked. Sadly nobody answers this :/ Belki birinin işine yarar **
code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
using System.Configuration;


    protected void btnisBaslat_Click(object sender, EventArgs e)
    {

            OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Server.MapPath("Database1.accdb") + "");
            con.Open();
            //OleDbCommand cmd = new OleDbCommand("update Personel set is_Tanimi='" + txtisTanimi.Text + "', baslangic_zamani='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' where ID = " + Session["UserID"], con);
            OleDbCommand cmd = new OleDbCommand("update Personel set tiklama='true' where ID=" + Session["UserID"], con);
            cmd.ExecuteNonQuery();
            //OleDbCommand cmd2 = new OleDbCommand("INSERT INTO Gorevler(Kadi,is_tanimi,baslangic_zamani,kull_id) values ('" + Session["Adi"] + "','" + DDLisSec.SelectedValue + "','" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "','" + Session["UserID"] + "')", con);
            //cmd2.ExecuteNonQuery();
            OleDbCommand cmd6 = new OleDbCommand("update GorevHareket set EndTime='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' WHERE StartTime IS NOT NULL AND EndTime IS NULL AND SessionId=" + Session["UserID"], con);
            cmd6.ExecuteNonQuery();

            OleDbCommand cmd2 = new OleDbCommand("Select * from Temsilci where ID=" + DDLisSec.SelectedValue, con);
            OleDbDataReader dr = cmd2.ExecuteReader();
            while (dr.Read())
            {
                if (dr["is_durum"].ToString() == "Beklemede")
                {
                    OleDbCommand cmd4 = new OleDbCommand("UPDATE Temsilci set Tipdurum=1 where Tipdurum=2 AND ID=" + DDLisSec.SelectedValue + " AND personel_id=" + Session["UserID"], con);
                    cmd4.ExecuteNonQuery();
                    OleDbCommand cmd3 = new OleDbCommand("update GorevHareket set EndTime='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' WHERE Tip=2 AND EndTime IS NULL AND GorevId=" + DDLisSec.SelectedValue + " AND SessionId=" + Session["UserID"], con);
                    cmd3.ExecuteNonQuery();
                    OleDbCommand cmd7 = new OleDbCommand("INSERT INTO GorevHareket(GorevId,SessionId,Tip,StartTime) SELECT Temsilci.ID,Temsilci.personel_id,'1' AS Tip,'" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' AS StartTime From Temsilci where Temsilci.Tipdurum=1 and Temsilci.personel_id=" + Session["UserID"], con);
                    cmd7.ExecuteNonQuery();

                    Response.Write("Beklemede olanlar çalıştı");
                }
                else
                {
                    //Response.Write(DDLisSec.SelectedValue);
                    OleDbCommand cmd4 = new OleDbCommand("UPDATE Temsilci set Tipdurum=1 where ID=" + DDLisSec.SelectedValue + " AND personel_id=" + Session["UserID"], con);
                    cmd4.ExecuteNonQuery();
                    OleDbCommand cmd3 = new OleDbCommand("update GorevHareket set EndTime='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' WHERE Tip=2 AND EndTime IS NULL AND GorevId=" + DDLisSec.SelectedValue + " AND SessionId=" + Session["UserID"], con);
                    cmd3.ExecuteNonQuery();
                    //OleDbCommand cmd4 = new OleDbCommand("INSERT INTO Gorevler(is_tanimi,kull_id,durum) values ('" + DDLisSec.SelectedValue + "','" + Session["UserID"] + "',1)", con);
                    //cmd4.ExecuteNonQuery();
                    //OleDbCommand cmd3 = new OleDbCommand("UPDATE Temsilci set temsilcigorevid=Gorevler.ID WHERE Temsilci.ID='" + DDLisSec.SelectedValue + "'", con);
                    //cmd3.ExecuteNonQuery();
                    //OleDbCommand cmd7 = new OleDbCommand("INSERT INTO GorevHareket(GorevId,SessionId,Tip,StartTime) SELECT Gorevler.ID,Gorevler.kull_id,'1' AS Tip,'" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' AS StartTime From Gorevler where Gorevler.durum=1 and Gorevler.kull_id=" + Session["UserID"], con);
                    //cmd7.ExecuteNonQuery();
                    OleDbCommand cmd7 = new OleDbCommand("INSERT INTO GorevHareket(GorevId,SessionId,Tip,StartTime) SELECT Temsilci.ID,Temsilci.personel_id,'1' AS Tip,'" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' AS StartTime From Temsilci where Temsilci.Tipdurum=1 and Temsilci.personel_id=" + Session["UserID"], con);
                    cmd7.ExecuteNonQuery();                                        
                    Response.Write("Null lar çalıştı");
                }

            }



                    //OleDbCommand cmd6 = new OleDbCommand("UPDATE GorevHareket set StartTime='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' Where [ID] = (SELECT MAX([ID]) FROM GorevHareket)", con);
                    //cmd6.ExecuteNonQuery();


        //cmd.ExecuteNonQuery();

            btnisBaslat.Visible = false;
            btnisDurdur.Visible = true;
            rbtnBekle.Visible = true;
            rbtnBitir.Visible = true;
            con.Close();
            dr.Close();



    }
    protected void btnisDurdur_Click(object sender, EventArgs e)
    {


        OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Server.MapPath("Database1.accdb") + "");
            con.Open();
            //OleDbCommand cmd = new OleDbCommand("update Personel set tiklama='false' where ID=" + Session["UserID"], con);
            //cmd.ExecuteNonQuery();
            //OleDbCommand cmd2 = new OleDbCommand("update Gorevler set bitis_zamani='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' where kull_id=" + Session["UserID"], con);
            //// OleDbCommand cmd2 = new OleDbCommand("UPDATE Gorevler SET bitis_zamani='"+ DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss")+ "',kull_id='"+Session["UserID"]+"' FROM Gorevler INNER JOIN Personel ON Personel.ID=Gorevler.kull_id WHERE kull_id="+Session["UserID"],con);

            //OleDbCommand cmd2 = new OleDbCommand("UPDATE Gorevler INNER JOIN Personel ON Gorevler.kull_id=Personel.ID SET bitis_zamani='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "',kull_id='" + Session["UserID"] + "' WHERE kull_id=" + Session["UserID"], con);
            //cmd2.ExecuteNonQuery();
            //OleDbDataReader dr = cmd.ExecuteReader();
            btnisDurdur.Visible = false;
            btnisBaslat.Visible = true;
            if(rbtnBekle.Checked==true)
            {
                OleDbCommand cmd = new OleDbCommand("update Personel set tiklama='false' where ID=" + Session["UserID"], con);
                cmd.ExecuteNonQuery();
                OleDbCommand cmd2 = new OleDbCommand("update Temsilci set Tipdurum=2 WHERE ID=" + DDLisSec.SelectedValue + " and Tipdurum=1 and personel_id=" + Session["UserID"], con);
                cmd2.ExecuteNonQuery();
                OleDbCommand cmd4 = new OleDbCommand("update GorevHareket set EndTime='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' WHERE Tip=1 AND EndTime IS NULL AND GorevId=" + DDLisSec.SelectedValue + " AND SessionId=" + Session["UserID"], con);
                cmd4.ExecuteNonQuery();
                OleDbCommand cmd5 = new OleDbCommand("INSERT INTO GorevHareket(GorevId,Tip,StartTime,SessionId) SELECT Temsilci.ID,'2' AS Tip,'" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' AS StartTime,Temsilci.personel_id From Temsilci where Tipdurum=2 AND ID=" + DDLisSec.SelectedValue + " AND Temsilci.personel_id=" + Session["UserID"], con);
                cmd5.ExecuteNonQuery();
                OleDbCommand cmd3 = new OleDbCommand("update Temsilci set is_durum='Beklemede' where ID="+DDLisSec.SelectedValue+" and personel_id="+Session["UserID"], con);
                cmd3.ExecuteNonQuery();

                //OleDbCommand cmd2 = new OleDbCommand("Select top 1 * from Gorevler where kull_id="+Session["UserID"]+" Order by ID DESC",con);
                //OleDbDataReader dr = cmd2.ExecuteReader();
                //while (dr.Read())
                //{
                //    Response.Write(dr["is_tanimi"].ToString());
                //}
            }
            else if (rbtnBitir.Checked == true)
            {
                OleDbCommand cmd = new OleDbCommand("update Personel set tiklama='false' where ID=" + Session["UserID"], con);
                cmd.ExecuteNonQuery();
                OleDbCommand cmd2 = new OleDbCommand("UPDATE Gorevler SET bitis_zamani='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "',is_durum='Bitti' where is_tanimi='" + DDLisSec.SelectedValue + "' and [ID] = (SELECT MAX([ID]) FROM Gorevler)", con);
                cmd2.ExecuteNonQuery();
                OleDbCommand cmd3 = new OleDbCommand("update Temsilci set is_durum='Bitti' where isin_adi='" + DDLisSec.SelectedValue + "'and personel_id=" + Session["UserID"], con);
                cmd3.ExecuteNonQuery();
            }
            else
            {
                OleDbCommand cmd = new OleDbCommand("update Personel set tiklama='false' where ID=" + Session["UserID"], con);
                cmd.ExecuteNonQuery();
                OleDbCommand cmd2 = new OleDbCommand("update Gorevler set bitis_zamani='" + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "' where kull_id=" + Session["UserID"], con);
                cmd2.ExecuteNonQuery();
            }
            rbtnBekle.Visible = false;
            rbtnBitir.Visible = false;

            con.Close();

    }   








}
Java txt loading code doesnt work and i dont know why

Java txt loading code doesnt work and i dont know why


By : Lawrence Sands
Date : March 29 2020, 07:55 AM
Hope this helps You should collect the text you wish to display into a StringBuilder and then display it:
code :
String line = null;
StringBuilder sb = new StringBuilder();
while((line = br.readLine()) != null) {
    sb.append(line);
    sb.append("\n");
}
textArea1.setText(sb.toString());
Related Posts Related Posts :
  • How do I make this image larger?
  • Run icCube with JDK 10
  • Expression with Math.random() always returns the same value
  • Getting the Set with the most elements nested in a HashMap using Java Streams
  • XmlSlurper to parse XML and get value of inside elements using Groovy
  • Extracting data from HTML and formatting the output
  • SOLR documentCache JMX metrics clarification
  • Limiting Wildfly 14 Two-Way SSL to specific clients
  • How do I get Min and max values to only print when "year" is entered?
  • Hashmap can't loop - getKey() method not found - Using Java 8
  • Android Studio - Create an EditText with a click of a button
  • Mockito Test not invoking verify() method
  • Wrap method implementations of Java interfaces
  • Remediating dynamic SQL into prepared statements
  • Where do X and Y start at in swing windows
  • Return page object from JPA query
  • I can't figure out why this code in my APCS multiple choice book returns 19
  • How to save data between methods
  • I'm trying to install Apache Gobblin. How can I install it using Gradle?
  • Spring Data Sorting Array or Set into Pageable
  • Question about the Java documentation and its implementation
  • How to make a JButton that when pressed it does a new action
  • Java hibernate No validator could be found for boolean
  • Making a POJO Thread Safe
  • Save the data of a text file in a arraylist
  • Sort a List<String[]> by indices using Comparator
  • Overloading in Java for user input?
  • Unable to format timestamp as YYYY-MM-DD HH:mm:ss in java
  • Access SQLite Helper From Adapter
  • How to stream a csv file with header to a HashMap<String, Double> in Java?
  • can't get go daddy ssl certificate to work with spring boot
  • ResourceBundle can't find BaseName gradle project java
  • Java; Jackson; Parsing the array of array json string
  • Java - map key lookup ignoring case
  • Jackson deserialize map null values to empty string
  • Anyone knows why setCount() is not working in twitter4j?
  • Object Visibility in a Multi-threaded Program in Java
  • Can't store and load an arraylist in an object file
  • convert a string number starts with `00` to `+` in java
  • Java - avoiding NonSuchElementException using ConcurrentLinkedDeque
  • Converting Immutable to mutable list Java
  • Getting nosuchmethod exception
  • How to get MQTT subscriptions
  • Android Google Sign in Exceptions
  • JavaFX - method that waits for user input
  • Replacing values for a particular key in treemap changes values for every key
  • This method call passes a null value for a nonnull method parameter. Either the parameter is annotated as a parameter th
  • Kafka: consume all messages on demand
  • Notify what text was changed in textview
  • Tinkerpop/Gremlin: select vertices together with outgoing edge count
  • transform a list of objects into a list of integers that pass a check
  • Why this java code is showing strange behavior?
  • Maven Project classes not compiling
  • Edit image to make text more clear opencv
  • Android Spinner nullpointer
  • Add result to int array every time you finish counting the occurrence
  • Android import java library
  • How to use LDAP Authentication in a corporate environment
  • adding item during iteration in java special usecase
  • How can I sort a map with string key? like (1 foo , 2 foo)
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org