Jump to content

OAFC_Rob

Members
  • Posts

    118
  • Joined

  • Last visited

About OAFC_Rob

  • Birthday 08/20/1988

Profile Information

  • Gender
    Male
  • Location
    UK

OAFC_Rob's Achievements

Member

Member (2/5)

0

Reputation

  1. Scrap that, it does work. It's the Mac file finder that's not updating the directory was changing but the file didn't seem to be but going via command line proved that the two lines of code were in fact working. Jesus, just lost enough time to this issue because of switching over to a mac grrr!!
  2. I have a folder in the following public structure; /public/assets/songs/test/mp3/test.mp3 and I simply want to rename it to; /public/assets/songs/test1/mp3/test1/mp3 So simply just change the main directory and the mp3 filename, simple enough or so I thought. I've tried loads of different combination and still can't seem to get both to rename. Here is the simplest form of my code; rename('./assets/songs/test', './assets/songs/test1'); rename('./assets/songs/test1/mp3/test.mp3', './assets/songs/test1/mp3/test1.mp3'); Any ideas? I have even tried to rename the directory with mv via exec but still nothing, this is really frustrating. $cmd = 'mv ./assets/songs/test ./assets/songs/test1'; exec($cmd, $output, $return_val);
  3. The HTML5 tags do work and I've seen no major issues with using them as long as you've included shiv for backwards compat. But it does seem strange that their examples are technically using outdated methods, just seems odd to me.
  4. Hi, I've been looking at the Bootstrap 3 and various tutorials / example sites even from their own website. This has lead me to a question I cannot seem to find a quick answer to why do they use divs over the new HTML5 tags such as nav. For example; <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Project name</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> </ul> </div><!--/.nav-collapse --> </div> </div> Comapred to something more like; <div class="container"> <nav> <ul> <li><a href="#"> Home </a></li> </ul> </nav> </div> I know these two examples don't match up in the slightest but I'm not looking for the synatx just an explaniation. Is it the fact that HTML5 is still the draft stages and IE doesn't handle nav to gracefully wihtout shiv etc... Or is the developer of the examples is just a bit lazy and couldn't be bothered to swap it to the newer tags? The reason I ask is I'm not too sure which way would be the best for developing a site using bootstrap. Thanks in advance.
  5. Hi, I have a paragraph of text that basically needs a label that is split into two columns for 100% width and 100% height. The label column needs to be a set minimum withd of 6.5em to cope for the longest labelling. I have tried a few different things and cannot figure out the best course of action. This is the best I've got so far; <p> <span>My Label</span> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> p { width: 100%; } p span { min-width: 6.5em; float: left; min-height: 3em; } The issue I have is I can set the height to a fix width which give me my desired effect, but it isn't responsive at all any help would be appericated.
  6. Solved it, I needed to completely remove the popup from the DOM when it has been closed!! $('#listPage').on("popupafterclose", ".ui-popup", function() { $(this).remove(); });
  7. Hi I'm havaing a problem with some JQM what is suppose to be happening, when the page is shown a list of data is to be shown. When you click one of the list items the popup needs to dynamically update with the text from the clicked list to display in the pop. i.e. if the item clicked is called Sales then the pop up item should be Edit Sales Here is the code I have $('#listPage').live('pagebeforeshow', function (event) { retrieveDisplayList(db, '', function (data) { tf.ui.hideLoadingMsg(); var template = Handlebars.templates.dataList(data); $("#listContainer").html(template); $('#listContainer').trigger('create'); var menuTarget = event.currentTarget; $('.listItem').click(function() { var txt = $.trim($(this).text()); var txtLabel = txt; var links = new Array(); links.push({ id: 'ID-1', page: '/index.html', name: 'Edit ' + txtLabel }); links.push({ id: 'ID-2', page: '/index.html', name: 'View Data' }); var popup = Handlebars.templates.popup({links: links}); $("#surveyPopup").html(popup); $('#surveyPopup').trigger('create'); $("#popup").popup('open', {positionTo: menuTarget}); //$('#surveyPopup').trigger('update'); }); }); });
  8. for(var i=0; i < result.rows.length; i++) { var item = result.rows.item(i); if ($('#test').attr('src') != item.photo) { $('#test').attr('src', item.photo); var canvas = document.getElementById('canvas2'); var context = canvas.getContext('2d'); $('#test').load(function() { context.drawImage(this, 0, 0); item.uploadPhoto = canvas.toDataURL(); console.log("PHOTOS"); console.log(item); _modifiedData[table].push(item.uploadPhoto); }); } I basically have image pathways coming from a DB and I want to get the canvas dataurl information for them. My idea is to retrieve the data push the image pathway to the image object load that into a canvas object get the data to an object. Once the data is in an object I need to preform a AJAX call to push this data to a PHP server to save the image. The problem I am having is the image load is happening after the AJAX call, and I can't figure out how to delay it.
  9. Resolved in a way, as I now have an image that is outputting from my server side code. JS Below var test = document.getElementById('test'); var canvas = document.getElementById('canvas2'); var context = canvas.getContext('2d'); context.drawImage(test, 69, 50); var dataURL = canvas.toDataURL(); params = {image: dataURL}; console.log("DATA TO BE SENT AS POST"); console.log(params); ServiceCall('http://alpha.tfcloud.local/tfbeacon/test.php', '', params, onResult, 'Submitting data', null); //ServiceCall is the same as the previous post <img id="test" src="./common_assets/images/other/upload.png" /> <canvas id="canvas2" width="578" height="200"></canvas> HTML Above $img = $_POST['image']; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = 'C:/' . uniqid() . '.png'; $success = file_put_contents($file, $data); echo $success ? $file.' SUCCESS!!' : 'Unable to save the file.'; PHP Above The only issue now is the logic and rendering of the images to to populate the canvas. As I originally wanted to pull all the data from the APP database build up my JSON data and AJAX it all to the server. However, I think i'm going to tackle this after some lunch
  10. I'm trying take an image from a handheld APP i'm developing and send it via a jQuery AJAX call to my PHP server. I know that I need to save the image as base64 for file transfer and then get my server-side code to decode the stream and save to disk. I have been following method one from this site http://mitgux.com/send-canvas-to-server-as-file-using-ajax However, it still isn't working when my PHP code save the image it is not viewable and I believe it's because the data isn't being sent in the stream correctly, can anyone help me!! var dataURL = './common_assets/images/other/upload.png'; params = {image: 'image/png; base64,'+dataURL}; ServiceCall('http://alpha.tfcloud.local/tfbeacon/test.php', '', params, onResult, 'Submitting data', null); function ServiceCall(url, method, params, onSuccess, loadingMsg, contentType) { url = $.trim(url); url = url + method; if(!url.endsWith('/')) { url += '/'; } var request = $.ajax({ url : url, type : 'POST', data : params, contentType : 'application/x-www-form-urlencoded; charset=UTF-8', //dataType : 'JSON', crossDomain : true, cache : false, success : onSuccess, error : function(jqXHR, textStatus, error) { if(jqXHR != undefined) { if(jqXHR.responseText != undefined) { var errorObject = $.parseJSON(jqXHR.responseText); if (errorObject.error != undefined) { msg = errorObject.error; } else { msg = jqXHR.responseText; } } } } }); }
  11. Thank you. So basically -All is preventing everything apart from mulitViews?
  12. Can anyone explain this line of .htaccess for me. Options -ExecCGI -Indexes -All -Includes I thought it was doing the following -ExecCGI = Prevent executable files -Indexes = Prevent indexes -All = Not sure about this one, thought it was doing something to do with prevention but not that I look at it I think it is prevent ALL from showing is that correct? -Includes = Prevent includes
  13. I've just done something similar and from my understanding javascript multi-dimensional arrays become javascript objects. I have attached the code that I did, might be some help to you. This gave me an object / multi-dimensional array like PHP; data => array(1 => array( id => 1, code => some code, desc => description, surveyDate => 27/11/2013, building => array( buildingCode => array( total => 150.00, count => 5, buildingID => 7, buildingCode => buildingCode, building => building description ) ) ) ); Hope that helps var data = new Array(); for (var i=0; i < surveys.length; i++) { var row = surveys.item(i); /** format any null data to something more useful */ var buildingCode = (row.buildingCode != null) ? row.buildingCode : 'Site Only'; var buildingID = (row.buildingID != null) ? row.buildingID : 0; /** if condition survey code is not the same as the previous then * reset the data for usage */ if (row.code != preRowCode) { preRowCode = row.code; prevBuildingCode = ''; var survey = new Array(); survey['building'] = new Object(); } /** if the building hasn't been set or is different then set the * prelimanary data */ if (buildingCode != prevBuildingCode) { prevBuildingCode = buildingCode; survey.building[buildingCode] = { total: row.totalCost, count: 1, buildingID: buildingID, buildingCode: buildingCode, building: row.buildingDesc }; } else { survey.building[buildingCode].total += row.totalCost; survey.building[buildingCode].count += 1; } survey['id'] = row.id; survey['code'] = row.code; survey['siteCode'] = row.siteCode; survey['surveyDate'] = row.surveyDate; /** assign the survey array to the data array, js crazy way of doing * a multi-dimensional array */ data[row.id] = survey; }
  14. Resolved!!! The problem was when I was retrieving the data from the DB I was just returning the row data straight out and not assigning it to an fresh object. It seems that there are issues if you do it that way.
  15. Sorry a typo being putting in the code on here, the console.log is correct and _idwork
×
×
  • 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.