Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by nik_jain

  1. hooks are fine. Its the API stuff that gets me. Ex: Code to set an extra value to a user programmatically, was too hard to figure out. From some forums posts: $uid = $this->currentUser()->id(); $userData->set('my_module', $uid, 'a_key', 'Here is a value'); Still not sure if this is the right approach. Drupal forums are also rather 'unsearchable' . No way to separate Drupal 7 posts from search results. But I have decided to not take the scratch approach, suck it up for once and dive deep into a framework. A plugin works, but certain custom coding would require deeper understanding of the platform. I am tempted to give symfony a shot instead, but I have been guilty of jumping too quickly from with a platform before... arghh
  2. I am struggling with drupal. The way I have always struggled with any CMS. There seem to to be many modifications requiring specific undocumented ways, that I find very frustrating. Would vastly prefer a framework, but the lure of the front end being handled by a CMS themes is very attractive, as its my biggest weakness. Suggestions ?
  3. Thanks maxxd. Not at all interested in doing it from scratch. Have done that before and it takes a lot of time. Yes, It is for work, kind of. No deadlines as such, but time is money. hmm, looking into drupal, and I guess you are right. It seems this way there would be very little coding. Makes me feel like an idiot for wasting so much time doing things from scratch. Not keen in wordpress btw. Seen too many bloated, loading-separate-jquery with each plugin websites.
  4. Columns are just for giving an idea. Far from complete/accurate
  5. Making a website with the following features. Wondering how everyone would go about coding this.. Tables: User: email, location id, other.. User location: coods, area,colony,city Posts : post, location id, type id, user id Posttype: type Functions: User sign up/in, with social signup Show posts: Filter by location, date , type etc. User Profile User set location Post details Similar posts Add post Moderate posts / Users So a fairly standard user registration + user posts + have profiles + browse posts website. With the addition of setting user location and filtering posts by location. Would you use a CMS or a framework or go commando by hacking together various components? How much time do you anticipate to take to code the backend ? Please assume TDD is followed. Thanks
  6. 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 .
  7. 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 ?
  8. 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
  9. eh I cannot ask about where I can post jobs, without implying I am looking for a job. logic 101
  10. 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.
  11. @Barand - sry didn't realise about the black text on black background thing, as I was using a 'dark night extension'
  12. 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
  13. 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
  14. 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.
  15. 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"] ; }
  16. 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
  17. 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
  18. 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.
  19. 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
  20. Use a DOM parser like querypath to parse the XML http://www.ibm.com/developerworks/library/os-php-querypath/
  21. Not tested, but in the last three lines in coded section $d should ( could ) be $fulo . for($fulo=$d;$fulo>0;$fulo--){ if($_POST['outcome'.$fulo] !==""){ $out=$_POST['outcome'.$fulo];break; }else{continue;} } $act=$_POST['activity'.$d]; $ind=$_POST['indicator'.$d]; $tar=$_POST['target'.$d]; and the else{continue;) is most probably not needed.
  22. Nope, I was kind of wrong about this one... lets hope I am able to get symfony..
  23. Agreed. I was quite hesitant to call it a framework, hence the word structure (some code that I can reuse) . It was obviously never meant for use by anyone other than me.. Well in my defense is the complete code of the site, not the actual 'structure' . Although I admit it doesn't even have a any kind of DB class Thanks a lot for your response. I have tried symphony in the past, will give it another shot. Though through another forum I discovered that its quite easy to get rid of blade in laravel, so I might give it a shot too! Thanks again
  24. I am PHP developer developing for the past 3-4 years, but except for CI I had always kind of struggled with any type of framework.. So I ended up not using most and just rolling my own frameworkish 'structure' . That ended up as a FANTASTIC learning experience, as I really got to understand what and how a real framework does/works. My complete source of the site wowpictures.link (which was made as a learning thing) is here: https://bitbucket.org/nikhil_jain/complete-wowpictures.link-source/src . Can someone take a quick look please . and offer suggestions / improvements / completely wrong things I did ? Secondly now I am hunting for a real framework, but I just find them too restriucitve / imposing. For instance yii seems too tied up with bootstrap, laravel like blade too much. Yii also seems to have a very specific class / method naming structure, that I find a chore to remember..etc etc. So what should I do? Learn any proper framework OR try to improve my own thingy ? I am strongly leaning towards th former option, but can't find a framework that doesn't forces random stuff no me .... Thanks
  25. two things. - Variables don't work inside single quoted strings - Since we are alreeady inside <?php tags the <?php echo $directory; ?> part doesn't require <?php and ?> . Also since we just want to join (concatenate) text , the echo is also not required. So Change $output = shell_exec('tar -czvf {$directory} <?php echo $directory; ?>'); to $output = shell_exec("tar -czvf {$directory}.tar.gz {$directory} " ) ;
  • 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.