Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


nik_jain last won the day on April 27 2015

nik_jain had the most liked content!

Community Reputation

2 Neutral

About nik_jain

  • Rank
    Regular Member

Recent Profile Visitors

1,951 profile views
  1. yeah I know about array_map. Hence why I mentioned I wanted to emulate it. I guess it is some kind of 'academic exercise' . I guess I should explain more clearly what I am thinking here. I was reading about on functional programming , one example focused on iterating an array. Where the imperative/normal way used a for loop to go through the array, and the functional way used the array_map function. This made me think how the array_map function internally scans the array. Does it use some functional way or does it use a for loop internally .
  2. I do not know the technical differences between for and foreach, but whichever is 'normal' here , it is not functional ? If so, is there a functional way of iterating an array that does not use loops ?
  3. This is just for fun/exploring. The normal way of iterating over a array is using a for() loop. The functional way is to use array_map . I am trying to write/emulate the array_map function in a functional way. Emulating the array_map using a for loop is easy: function array_map_me_normal($callback,$arr){ $returnArr = []; for ($i =0 ; $i < count($arr);$i++){ $returnArr[] = $callback($arr); } return $returnArr; } But emulating array_map using a functional approach seems to be tricky. Not sure if its even possible. I think it should be possible.. function array_map_me_functional($callback,$arr){ if (empty($arr)){ return false; } return [$callback(array_pop($arr)), $callback($arr)]; } The above is incorrect ofcourse. Returns increasing nested array. But I couldn't do better. Is there a way ? or will an array_map function always be using for loop under its hood ? Thanks
  4. eh I cannot ask about where I can post jobs, without implying I am looking for a job. logic 101
  5. Hey thanks for such a detailed critique. But I was able to only get a few things. The site is not being marketed at all. Because A. I don't know how to at all ! B. The poor response discouraged me. The points I think got were: - The site content is such that generally people are unlikely to search for its functions and find it on google ? - It can only be used by someone who already knows what the tool will do when they come to page ? i.e the objective of the website/tool isn't being made clear at all ? - I didn't mention the parent ecommerce website ? ok. This is a big oversight on my part. It doesn't even tell the target country. damn! didn't understand .. About uneasy design: Could you please elaborate ? Is the text too little ? too much ? no pics ? Its a pretty standard bootstrap template.. maybe that 's the problem ? Maybe offtopic, but how much should I look to spend to improve its design. I think I need a UX person... Thanks a lot again.
  6. @Barand - sry didn't realise about the black text on black background thing, as I was using a 'dark night extension'
  7. Me PHP guy looking for work. Where all on the internet can I add my 'I am PHP guy, looking for other PHP developers to work for' ? I have posted in the 'services offered' section and on reddit. Any other place ? upwork is an option , but a very discouraging one. No replies after 10 well thought out bids. Lets not even talk about freelancer.com Thanks
  8. https://fallinprices.com/ - Its affiliate site for an ecommerce site. What it does: Basically for user it shows products by several criteria - price,brands, features etc. Then the user can enter their email and get notifications related to their chosen criteria. So a user can get to know about 'new prodducts' n price changes , of product A from brands 'B C' of color 'green' between price 'P1 P2' . Problem is I haven't got a response at all! No criticisms either, but just went under the radar . Is it hard to understand ? Are the number of products too low ? Am I not a design guy , but seems fine to my eyes. Made it responsive as well. Comments Please. Thanks
  9. Use JavaScript to keep adding more input fields. I suggest to use jQuery for this . See jQuery docs or google to find how to append elements using jQuery. Something like: if (clicked on last form element){ $parentForm.append('<input>New elements />') } This will require learning and getting familiar with jQuery and maybe javascript as well. This is the frontend part. You will also need to pass these new form values to server. For this Each field should have a unique 'name' html attribute or you can use an array See this. Then handle the POST data with PHP. And store appropriately in a database.
  10. Easy. Just use sessions. Sessions are user specific data stored on the server/site for an extended period of time. So they don't get deleted between requests. Browser sends session cookie on every request to identify which data in the session belongs to them. session_start() ; // at the top of every page //Store $_SESSION["favcolor"] = "green"; $_SESSION["favanimal"] = "cat"; //Fetch if (isset($_SESSION["favcolor"] ) && $_SESSION["favcolor"] ){ return $_SESSION["favcolor"] ; }
  11. My best work periods have been when I closely worked with another coder, who handled all the freelancing managing the clients and I helped on the coding side. Looking for more of the same. Me: Nikhil. 5+ years coding. Techy, nerdy and proud. Cygwin, oh my zsh, freebsd, DIY , autoit, arduino! Speaks decent english. Understands importance of communication. 20$ / hour. India. UTC+5:30. Great at: Core PHP, JavaScript, SQLite, MySQL, HTML. Understand modular OOP coding, MVC framework, understanding of all things PHP. Ok at: CSS, Linux admin Recent Work: Handled ALL aspects of development and sys admin. https://fallinprices.com/ - Price and products tracking according to criteria. fetch API - store sqlite - Compare - updatedb - show interface, update interface, send mails .. and on. http://jobs.megyaani.com/ - r/forhire notifications according to user search terms! I also do: Scraping, automation, API consumption, Oauth2 and some more. Do I Seem like your guy? Mail me : nik.jain@gmail.com
  12. Purpose: Building a search function for a site, that's supposed to be fast, give results as a user types. Queries would be something like: "brand1 brand2 brand3" . My idea is , instead of querying the database on each ajax request. A keyed array is created once. Like: ['brand1' => id , 'brand2 => id2 ]. This array is stored in memory. The next time a query is sent, the array which is instantly available in memory, and can be simply queried $storedArray['brand1']to fetch any existing ids instantly. The array size would be about 750 Kb. 60000 rows. I don't have much experience with caching , so looking for advise whether what I am trying to do even makes any sense or necessary. I know there are solutions like memcache. But not sure if my tiny project requires them. Also does opcache help here ? Would serializing the array be too slow ? Please ask if any questions. Thanks
  13. This is late. SOrry my question wasn't clear. But I found that in this instance prepared statements cannot be used. The SQLITE syntax required literal that PDO driver could not just pass and there was no way of escaping. Note I could escape the parameter passing it from PHP to PDO . But could not escape it from PDO to sqlite.
  14. SQLITE has syntax like ' WHERE MATCH ( 'colname : "one two" )' //My pdo sql query $sql .= MATCH 'colname : "?" )'; $pdo->bindValue(1,$text);` But Pdo placeholders can't have quotes around them. So this does not work. I tried a million variations of the placeholder syntax "?" "" ? "" """ ? """ \" ? \" . But nothing works. Errors I get : General error: 1 near "?" | 25 column index out of range . Also for this query : MATCH ( names: ? AND categoryids: ? ) , the error is: `General error: 1 unrecognized token: ":"` Would really love some help here.. Thanks
  15. Use a DOM parser like querypath to parse the XML http://www.ibm.com/developerworks/library/os-php-querypath/
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.