User Profile

Collapse

Profile Sidebar

Collapse
samvb
samvb
Last Activity: Apr 6 '19, 09:26 PM
Joined: Oct 20 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • unit testing a method that asks two user inputs() in console

    I have this small console app to add two numbers by asking the user to enter 2 numbers:

    Code:
         def add():
             a = int(input('Enter first number '))
             b= int(input('Enter second number '))
             return a + b
    How do I unit test that? I tried the following but it returns false always even though it doesn't ask for user input which is great:

    2
    3
    4
    5...
    See more | Go to post

  • (Reason: CORS request did not succeed) DRF and Angular

    Hi,

    We have a DRF backend API and two front-end applications: a CRUD and a report server. Currently, we have issue with CORS:

    These are the domains:

    sever.com:8098 == >backend

    and front ends:

    crud.com
    reporter.com

    ==

    backend settings.py is:



    Code:
    DEBUG = False
    
    
    ALLOWED_HOSTS
    ...
    See more | Go to post

  • samvb
    started a topic django celery not reading .env envrionment

    django celery not reading .env envrionment

    Hi,

    I fire up celery in a separate terminal and it works great but it ain't reading my .env file which my django application currently uses.

    How do I tell celery where the env file is located and how to use it?
    See more | Go to post

  • finding best move in a multi-dimensional array driven tic-tac-toe game

    Hi,

    I am trying tic-tac-toe game with multi-dimensional array. I saw many posts online but almost all use single dimensional and frankly, I didn't really understand the portions regarding detecting the best moves.

    It is an API (with no interface) so interaction is using GET method. So first time server/computer makes the move, the response will be:

    ****s****
    where * is empty square and s is...
    See more | Go to post

  • JQ/CodeIgniter App: CORS header 'Access-Control-Allow-Origin' does not match *

    Hey Fellas,

    I am seriously in despair. I have a CI driven app in domaina.com. I need to send cross domain request to a SINGLE controller in it from domainb.com. It will be an ajax call using POST method. It sends a single number and get a text reply from domaina.com.

    htaccess is not really an option as I only call a single controller domaina.com/check (then a couple of methods in check controller). Here is what I have...
    See more | Go to post

  • Full-Width sliding images ugly in big screen [sdkslider]

    How do you solve such a problem? I am using sdkslider jQuery plugin to have a full-width sliding images. The images are maximum 1280 wide and 1024 in height. Here is the problem now...

    The sdkslider comes with predefined CSS setting where its height is 550px or so. Image must be set to the same height too. 100% hides the image deep inside the containing div.

    In big screens, the images are really stretched and look extra...
    See more | Go to post

  • blueimp jQuery upload plugin unresponsive in production

    I have implemented blueimp jQuery upload with CodeIgniter three. It works great in my development server but not in production. I have used the default script.js provided. During upload, the file uploaded shows 100 with tick (to be it is uploaded at least to temporary folder or something) but it never goes anywhere. After upload is completed, it redirects but here, the done event doesn't get fired at all.

    I confirmed that my form is...
    See more | Go to post

  • samvb
    started a topic Find strings between {} using regex?
    in PHP

    Find strings between {} using regex?

    Hey All,

    I have a string that contains substrings in following fashion:

    abc 1235 {X} sdsdf {Y} ddielf {JP}....

    I want to store all those strings between {} so above would return an array/CSV X,Y,JP.
    the following finds the very first occurence only. Any idea on how to make it searcj a;;

    Code:
    $str = 'a {A} 90';
    
    $start = '{';
    $end = '}';
    
    $pattern = sprintf(
    ...
    See more | Go to post

  • samvb
    started a topic File/Media Manager for CodeIgniter 3?
    in PHP

    File/Media Manager for CodeIgniter 3?

    I been googling for three days to find a decent file manager for CI. I have downloaded a few free/open source but not satisfied:

    fileman : small foot print and easier but hard to integrate to CI due to security issues (getting CI Session status outside the CI is hard).

    KCFinder: again hard to integrate into CI.

    All others I tried fall along the same problems. Or there is a secure way to pass the CI instance...
    See more | Go to post

  • Yes Rabbit, we want relative except it is not working. Absolute paths are uncomfortable as some departments use a different domain and that means for each dept or institution, we have to manually edit the JS before distribution.
    See more | Go to post

    Leave a comment:


  • Creating portable JS functions containing ajax url calls

    Alo,

    Hope my title is clear...am part of a team that works with CodeIgniter. The HTTP links are in this fashion: www.abc.com/content www.abc.com/content/edit/2

    Now, we have some javascsript ajax functions that are shared thru out various sections of the application. One is this:

    Code:
    function getXtime() {
            var result = "";
            $.ajax({
                type: "GET",
    ...
    See more | Go to post

  • samvb
    started a topic roxy fileman dynamic return_url

    roxy fileman dynamic return_url

    Ola all,

    I am trying to use roxy fileman with ckeditor to browse files. In its conf.json is a setting RETURN_URL_PREF IX which when explicitly set works fine (i.e. images are shown and all). But i have a dynamic envrionment and setting this now and then is quite hard.

    Someone suggested on SOF to play with main.js and sure enough lines 704 and 809 contain if RETURN_URL_PREF IX condition but no matter what I changed, nothing...
    See more | Go to post

  • samvb
    started a topic one customer database for multiple different business

    one customer database for multiple different business

    Alo all,

    We are targeting specific kind of customers who use different kind of services such as fashion shops, cosmetics etc. This service providers just buy a package (domain, web site, db etc) and they are good to go. Now they customers are repeated time and again and so a single customer is registered 5-6 times in a single computer running mysql server with database for each service.

    I want to have a single customers...
    See more | Go to post

  • samvb
    started a topic Wordpress Like Templat Selection System
    in PHP

    Wordpress Like Templat Selection System

    Hiya all,

    I really need your help with understanding. But first, please avoid offering wordpress or so as a solution. I have a couple of templates (more to come) done from scratch to meet a specific business type (very specific). My problem if a customer selects one template, how do I really attach it to his/her sub domain? Do I copy the code folders of the selected folder to another folder with his domain or what? How do wordpress...
    See more | Go to post

  • samvb
    started a topic fully disable Framework7 animations?

    fully disable Framework7 animations?

    am using framwork7 and it is one hell of a library but bad at animation. It works in some OS version, it is sluggish in some...now i just want to disable the animations alltogether for the function is all i am after.

    During ini, i have the following:

    Code:
    var myApp = new Framework7({
        modalTitle: 'MeLife',
        // Enable Material theme
        material: true,
    	animatePages:false,
    	externalLinks:'.external',
    ...
    See more | Go to post
    Last edited by Rabbit; Aug 18 '15, 04:08 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

  • HTML5 JS Android app to access apache driven server

    For my application, i am allowing requests to come from anywhere (at development stage). It just sends ajax requests to php files on the server and it works great.

    It is based upon allowing access to all request headers sent to apache, which is obviously not a good idea.

    What's the work around to make only my applications request be accepted by my server? I thought of including some sort of key that is sent with every...
    See more | Go to post

  • samvb
    replied to Send MMI or USSD code via html5 and JS?
    How about with server tech like PHP?
    See more | Go to post

    Leave a comment:


  • samvb
    started a topic Send MMI or USSD code via html5 and JS?

    Send MMI or USSD code via html5 and JS?

    Is it possible to do something like that? Much like the <a tel> tag for android and ios, is there such a way to send MMI so i can check for e.g. balance?
    See more | Go to post

  • btw, how do i close a topic?
    See more | Go to post

    Leave a comment:


  • I posted the SP that is called by the inserting SP. The above SP just generates CSV id numbers which are processed by the calling SP that inserts the records into the table (not shown here). Anyway...it is now solved.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...