Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Prahlad Yeri

@Prahlad Yeri
About
Posts
16
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • What is the right technique to automate Android builds from command line with gradlew command?
    P Prahlad Yeri

    I want to build my Android Studio project from command line as opening it consumes too much RAM. Besides, my app is "WebView heavy", most of the work happens in HTML/JS/CSS inside of the webview, so it makes sense to build the APK/AAB directly from command line for testing. So far, I'm able to generate bunlde with the below command after setting the JAVA_HOME to `\path\to\android-studio\jre\jre` gradlew bundle However, this generates only the bundle file (*.aab) and that too the unsigned or debug version. What I want to generate is: 1. Signed *.aab to release on Play Store. 2. Unsigned *.apk for testing. When I list the tasks using `gradlew tasks` command, it gives me the below. What should I do to achieve these objectives? I already tried some other tasks (build and assemble) as parameters but they result in error. **EDIT:** OK, found some helpful information [here](https://developer.android.com/build/building-cmdline). The second one (debug APK) I managed with the `assembleDebug` task. The first one (signing the aab) is still a constraint.

    > Task :tasks


    Tasks runnable from root project

    Android tasks

    androidDependencies - Displays the Android dependencies of the project.
    signingReport - Displays the signing info for the base and test modules
    sourceSets - Prints out all the source sets defined in this project.

    Build tasks

    assemble - Assemble main outputs for all the variants.
    assembleAndroidTest - Assembles all the Test applications.
    build - Assembles and tests this project.
    buildDependents - Assembles and tests this project and all projects that depend on it.
    buildNeeded - Assembles and tests this project and all projects it depends on.
    bundle - Assemble bundles for all the variants.
    clean - Deletes the build directory.
    cleanBuildCache - Deletes the build cache directory.
    compileDebugAndroidTestSources
    compileDebugSources
    compileDebugUnitTestSources
    compileReleaseSources
    compileReleaseUnitTestSources

    Build Setup tasks

    init - Initializes a new Gradle build.
    wrapper - Generates Gradle wrapper files.

    Cleanup tasks

    lintFix - Runs lint on all variants and applies any safe suggestions to the source code.

    Help tasks

    buildEnvironment - Displays all buildscript dependencies declared in root project 'Python MCQ'.
    components - Displays the components produced by root

    Android android java help question announcement

  • JSON data format for MCQ data bank
    P Prahlad Yeri

    I'm creating a data bank of MCQ (Multi Choice Questions) and their answers so that an app can be built around it. Regarding the actual storage format, I have two ideas: 1. An array of objects with keys (`q` for question, `a` for choice-a, etc.). 2. An array of arrays. The first one is obviously more readable. Here is a brief sample of what I have so far: ```json { "data": [ { "q": "What kind of language is Python?", "a": "Compiled", "b": "Interpreted", "c": "Parsed", "d": "Elaborated", "r": "b" }, { "q": "Who invented Python?", "a": "Rasmus Lerdorf", "b": "Guido Van Rossum", "c": "Bill Gates", "d": "Linus Torvalds", "r": "b" } ] } ``` The app will read the q key to print the question, then present the four options (a, b, c and d). And the last key (r) will store the right answer. This is very much readable when viewed as a JSON file also. However, what I am thinking is that once the data-bank grows in size into hundreds/thousands of QA, a lot of space will be wasted by those keys (q,a,b,etc.) isn't it? In this case, an array like this is more efficient from storage perspective: ```json { "data": [ [ "What kind of language is Python?", "Compiled", "Interpreted", "Parsed", "Elaborated", 1 ], [ "Who invented Python?", "Rasmus Lerdorf", "Guido Van Rossum", "Bill Gates", "Linus Torvalds", 1 ] ] } ``` In this case, each array will have 6 items viz. the question, four choices and finally the index of the correct choice (1==Interpreted, etc.). Which of these two formats is better? Feel free to suggest any third format which is even better than these two.

    The Lounge question python database data-structures beta-testing

  • PySide vs. .NET WinForms for a Desktop GUI App in 2023?
    P Prahlad Yeri

    Hello Folks, For an upcoming side project - a Desktop GUI app, open source, Apache 2.0 licensed, I'm slightly confused regarding what technology to use. Skills wise, C#/WinForms should be my natural choice as that was the primary technology I had worked on before losing employment at Tech Mahindra few years back and getting into freelancing. But post my freelance experience, I taught myself things like open source and Python as it came with the territory, and now PySide2 is also a running candidate in this race! The goal here is to be as much ubiquitous as possible - that my app should be easy to just "download, extract and run" by as many people as possible. A couple decades ago, a .NET GUI library targeting Microsoft Windows platform would have been the clear choice here as most people used Windows OS and targeting that platform meant being ubiquitous. But over the last few years, I've observed that Windows OS has been continuously losing its market share to Linux Distros and Mac OSX, mostly due to some incorrect decisions and strategic blunders by the former than some ground breaking or revolutionary innovation on part of the latter. This means .NET or WinForms is no longer the ideal choice today if you want to be cross-platform and ubiquitous. This lead my research to some other toolkits like the Java Swing library, for example. It's old but classic, not a bad choice at all in this case, platform independence is Java's biggest selling point. However, the app I'm making is non-trivial and slightly performance intensive, and Swing GUIs are known to be sluggish on PCs unless you ensure a good supply of RAM by tweaking the JVM settings. I'm also not very experienced in Java to be able to handle those situations in case they arise. I also considered Lazarus IDE/Object Pascal, it is also not a bad choice. It is open source, used as the primary course language across many Universities in Europe and most importantly, still maintained and developed. But guess I will have to teach myself a whole new paradigm along with a programming language in case I go this route. Finally, Python is something I've almost settled on for this project. It's a language that I'm very fond of and it has helped me survive through the tough times in the freelance market. It also has a vibrant ecosystem and rich repository of user contributed packages like PyPI. Now, I've worked on the default Tkinter library in past but somehow felt that it's quite limited in terms of making the GUI more flexible and "tweakable", espec

    The Lounge csharp java delphi visual-studio python

  • Honest Question: What do you do when you lose motivation to code?
    P Prahlad Yeri

    This is one of the least talked about topic. Believe it or not but programming is hard and creating a mind-blowing software (or even going about changing/fixing an existing one) is a creative task about as difficult as creating a best selling novel or story. Irrespective of whether or not you believe software development is creative (yeah, some folks like to think of it as a purely logical "hard science" which is full of rules and no creativity), you can't deny that there are times when you feel low motivation. Even the most experienced of coders face this sometimes. A problem here is that you can't ask this on any forum because the most usual reply you get is, "Programming isn't for you dude, just choose any other field"! This, I think is both uncalled for and inhumane. If you have nothing positive to offer, at least don't demoralize further an already troubled soul. Well, coming back to the title, what do you do to motivate yourself when there is a project ahead but you just don't feel like working or you sit on the desk and start typing but nothing gets typed there, almost like a "Writer's Block"!

    The Lounge question help

  • Best option for a local/standalone database in a desktop project?
    P Prahlad Yeri

    Yep, I considered lighter file formats for storage such as XML and JSON. What I've read so far suggests that appending specific data chunks to these files become heavier as the data increases. And considering that this method needs pulling of entire file to memory, it might get slower over time as the DB size approaches several hundred MBs or even a GB? In contrast, Sqlite driver just performs CRUD operations on the file, so performance might be better?

    The Lounge csharp database sqlite winforms business

  • I give up
    P Prahlad Yeri

    honey the codewitch wrote:

    Programs that have invisible source code belong in the trash.

    It all depends on the design and robustness of the language or runtime though. Java web programming, for example, sits on many layers of invisible code such as JVM, Servlets, J2EE/JSP, Spring, etc. and yet it performs amazingly fast and used throughout the enterprise! By your logic, it must be pathetically slow due to these layers and dumped into trash by now.

    The Lounge python

  • I give up
    P Prahlad Yeri

    Python used to be actually great in the 2.x days when Guido used to be the benevolent leader. Somewhere down the line, I don't know what happened but they lost the track along the 3.x path. No doubt, Python has a lot of mind-blowing stuff like nltk, django, flask, etc. but that's all thanks to the ecosystem! Core python has only gotten slower and slower since 3.x without getting any benefits in exchange for that slowness. There is a lot of scope in that dynamic language though. With some effort, they can probably make it perform on par with at least PHP or Java, if not C#.

    The Lounge python

  • Best option for a local/standalone database in a desktop project?
    P Prahlad Yeri

    BryanFazekas wrote:

    SQL Lite and SQL Express need to have tools installed, so those have to be installed and configured (probably no worse than MS Access). I don't know if the DB can be handled as a file, and included in an installer. I lack the knowledge to know if this is a problem.

    I don't know about sql express but used sqlite extensively. In terms of "tools", a single command line program called sqlite3.exe is typically used though "proper" IDEs like DBeaver come with their own libraries for creating and managing sqlite files. For .NET and C# specifically, System.data.sqlite is the standard way I believe, they provide both downloadable .NET DLLs and nuget packages. Through this library, you can create and manage sqlite data files through code. Regarding working with mdb without MS-Access, I'm thinking DAO which I believe is an ancient library but still ships with most recent windows systems?

    The Lounge csharp database sqlite winforms business

  • Best option for a local/standalone database in a desktop project?
    P Prahlad Yeri

    I'm working on a winforms desktop side-project in c#, it's for my internal project management, storing milestones and tasks, client notes, mcq quiz, etc., the idea is to open source it later. I'm considering sqlite for database as it's the typical choice for standalone projects, isn't it? Another option is ms-access which works great but the caveat is that I don't have ms-office installed, I use LibreOffice instead. Is it possible to create and mange access databases (*.mdb) purely with ADO.NET code or do we need MSO installed? If not, what other database would you suggest for this kind of project?

    The Lounge csharp database sqlite winforms business

  • Help me decide what technology should I use for this project
    P Prahlad Yeri

    I'm a solo freelance programmer and want to write an app for internal project management, something I can add projects, milestones, tasks, etc. and track them as I work on them, occasionally remind me of things like take a break, lunch time, etc. and over time I can track on which category (like python, php, c#, etc.) I worked how many hours, etc. I'm actually confused between whether to build this as a Web or Windows Desktop app. I'm considering latter because it can run efficiently on my laptop in the system tray using least memory, web-based on the other hand will force me keep running an apache server too which will be an overhead (unless I host it on Google Cloud or someplace which might be an option?) The only reason for considering web-based is that eventually I'm planning to make this tool open source and with web-based, many others can find this useful too (including OSX/Linux users). At that point, I may consider expanding it's database to include multi-user connectivity, client login, etc. but that's going too far at this point! The idea is that this tool should be useful not just for me but other freelancers, students, etc. who might be in my shoes. From that perspective, what do you think is the right technology to use? Web based or Windows based? (I’ve extensively worked on C#/WinForms projects before and I’m thinking Visual Studio Express for desktop development. If web-based, it’ll be php/mysql based)

    The Lounge csharp cloud python php apache

  • Which technology is worth investing your time and energy right now?
    P Prahlad Yeri

    That's interesting but I'm a bit skeptical about low code or no code. They've been talking about it since a long time but coding jobs have only gone higher and higher. In fact, it could be argued that engineers have been trying the "low code" approach ever since the day they started coding, be it procedural programming in C/C++, OOP in Java/C#, coding patterns and frameworks later on, etc. But ironically, the coding complexity and tasks have only increased ever since! Adding additional layers on top of raw code (like libraries, frameworks, CMS, etc.) may give you the false sense of "no code" but the underlying layers still have to dealt with someone (if not you). That's just the nature of how code and technology works?

    The Lounge javascript career java python php

  • Which technology is worth investing your time and energy right now?
    P Prahlad Yeri

    The investment you make in your skills also follows a similar pattern to financial investments, i.e. high risk equals high reward. In 1995, if you had told me to invest my skills in this little known language called Java by a small company called Sun Microsystems, I'd have rebutted you saying you've probably had a few drinks too many! Who would have thought Java will be used to write just about anything (including mobile apps) some day? On the other hand, had the "risk taker" in me had jumped on the Blackberry development in 2010 or Windows Phone development in 2015, his career would have failed quite miserably! Similarly, had the "risk averse" buddy chosen something like COBOL or C in 1995, he'd probably still have a low paying job to stick with for several years to come. From that perspective, what do you make of the current technologies like Java and Python and PHP? And what about all the JavaScript frameworks (React, Vue, etc.) and the Node/NPM ecosystem? Where do you see all of this going?

    The Lounge javascript career java python php

  • A simple proxy server in C#
    P Prahlad Yeri

    Thanks. The Poll() method really helped. I'm now polling for three seconds before receiving for both client and the server. However, there is still some logical issue with my code:

                        if (client.Poll(3000 \* 1000, SelectMode.SelectRead))
                        {
                            rec = client.Receive(buffer, buffer.Length, SocketFlags.None);
                            Debug.Print("RECEIVED FROM CLIENT: " + Encoding.ASCII.GetString(buffer, 0, rec));
    
                            sent = webserver.Send(buffer, rec, SocketFlags.None);
                            Debug.Print("SENT TO WEBSERVER\[" + sent.ToString() + "\]: " + Encoding.ASCII.GetString(buffer, 0, rec));
                            transferred += rec;
                        }
                        else
                        {
                            Debug.Print("No data polled from client");
                        }
    

    As I said, one logical fault still remains. In the proxy client machine, I'm able to open google.com. Then performed a search that also went fine. However, when I click on a search result, the proxy again gives me google.com!! What am I missing?

    C# csharp sysadmin debugging help

  • A simple proxy server in C#
    P Prahlad Yeri

    Is there a way to check the data in the socket and call Receive() only when data is available for receiving. This way it should not block, right?

    C# csharp sysadmin debugging help

  • A simple proxy server in C#
    P Prahlad Yeri

    Thanks Richard. For reasons of simplicity, I don't want to create anync calls and handle everything in thant one thread only. Is there no way to do this using the sync Receive() method ?

    C# csharp sysadmin debugging help

  • A simple proxy server in C#
    P Prahlad Yeri

    I have written a simple and minimalist HTTP proxy server that runs on command line. In the Start() method, a TcpListener blocks until it gets a client request and creates a new thread (ThreadHandleClient method) that processes this client, fetches its url and relays data. The trouble is in the relay logic that I want to refine. In the first inner loop, I receive all webserver data and send it to client until zero bytes are left. In second inner loop, I do vice-versa: receive all client data and send to web-server until zero bytes left. However, the code gets blocked in the beginning of second inner-loop at client.receive(). This is what I'm basically doing: Any help will be truly appreciated. Thanks in advance.

    public void Start(IPAddress ip, int port)
    {
    try
    {
    TcpListener listener = new TcpListener(ip, port);
    listener.Start(100);
    while (!stopFlag)
    {
    Socket client = listener.AcceptSocket();
    IPEndPoint rep = (IPEndPoint)client.RemoteEndPoint;
    Thread th = new Thread(ThreadHandleClient);
    th.Start(client);
    }
    listener.Stop();
    }
    catch (Exception ex)
    {
    Debug.Print("START: " + ex.Message);
    }
    }
    public void ThreadHandleClient(object o)
    {
    try
    {
    Socket client = (Socket)o;
    NetworkStream ns = new NetworkStream(client);
    //RECEIVE CLIENT DATA
    byte[] buffer = new byte[2048];
    int rec = 0, sent = 0, transferred = 0, rport = 0;
    string data = "";
    do
    {
    rec = ns.Read(buffer, 0, buffer.Length);
    data += Encoding.ASCII.GetString(buffer, 0, rec);
    } while (rec == buffer.Length);
    //PARSE DESTINATION AND SEND REQUEST
    string line = data.Replace("\r\n", "\n").Split(new string[] { "\n" }, StringSplitOptions.None)[0];
    Uri uri = new Uri(line.Split(new string[] { " " }, StringSplitOptions.None)[1]);
    Debug.Print("CLIENT REQUEST RECEIVED: " + uri.OriginalString);
    if (uri.Scheme == "https")
    {
    rport = 443;
    Debug.Print("HTTPS - 443");
    }
    else
    {
    rport = 80;
    Debug.Print("HTTP - 443");
    }
    IPHostEntry rh = Dns.GetHostEntry(uri.Host);
    Socket webserver = new Socket(rh.AddressList[0].AddressFamily, SocketType.Stream, ProtocolType.IP);
    webserver.Connect(new IPEndPoint(rh.AddressList[0], rport));
    byte[] databytes = Encoding.ASCII.GetBytes(data);
    webserver.Send(databytes, databytes.Length, SocketFlags.None);
    Debug.Print("SENT TO SERVER. WILL NOW RELAY: " + data);
    //STA

    C# csharp sysadmin debugging help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups