Posts

Showing posts from August, 2014

php - Topic search in search engines -

i developing website similar web forum. users post queries , others them through replies. in many websites mine, topic of query included in url, e.g. www.sample.com/topic-1.html or www.sample.com/topic-2.html , , these links can found via search engines. how can dynamically generate html files , configure website search engines can access it? no, aren't putting these files on web server manually. rewriting urls using web server (e.g. apache2/nginx). check response headers more info happens behind scenes. please see how create friendly url in php?

ios - Global variables in swift do not change -

i created couple global variables app load image string. when try change value stay same however. value doesn't change after didselectrowatindexpath method called still "initial". import uikit var teststring = "initial" class subjectsviewcontroller: uiviewcontroller { ..... func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: true) imagefiles[indexpath.row].getdatainbackgroundwithblock { imagedata, error in if (error == nil) { selectedphoto = uiimage(data: imagedata)! println("should change variables") teststring = "testing" println("no error in fetching image") } else { println("there error getting image") } } self.performseguewithidentifier("detailsegue", sender

How to get description of Desktop Icon in Windows via batch code? -

i need form guys,i want know ,how can description of desktop icon using batch code? sorry bad english not possible pure batch.but can try tooltipinfo.bat or shortcutjs.bat . hybrid scripts combine wsh/jscript/batch , should saved .bat extension. here's how can use them: tooltipinfo.bat "c:\users\my\desktop\git shell.lnk" or shortcutjs.bat -examine "c:\users\my\desktop\git shell.lnk"

javascript - use ajax to get controller action render in same page -

this code of view i have dropdown option having value of /controllername/actionname. when click dropdown value redirects me page selected controllername , actionname. want render view in same page using ajax. view should rendered inside empty div tag below. can me @model demo.models.student @{ viewbag.title = "index"; } <h2>hello student</h2> <select id="foo"> <option value="">pick action</option> <option value="/home/index">home</option> <option value="/home/profile">profile</option> </select> <div id="main"> </div> <script> document.getelementbyid("foo").onchange = function () { if (this.selectedindex !== 0) { window.location.href = this.value; } }; </script> try this <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js&q

.net - Running a Visual Studio Online project on Macbook Pro -

i need trying run visual studio project on mac. purchased new mac , need make sure machine setup correctly .net development. so far i've cloned project visual studio online , need able run through localhost , edit files. all can see in project .sln, have no real expertise on except read online been solutions files. any out there? thanks use visual studio in mac bootcamp – boot camp multi boot utility included apple inc.'s os x assists users in installing microsoft windows operating systems on intel-based macintosh computers this apple way of allowing run windows on intel-based mac. use built-in bootcamp assistant, make partition , install windows. once done, can boot windows instead of osx , reuse of i/o (input-output) drivers peripherals. in mode, windows running natively “on metal” , full performance benefits. of course means can install visual studio , write c# day, in windows machine. virtual machines – if choosing os boot isn’t cup of tea

php - Codeigniter order by time - query generation -

i need mysql query like select *, concat(pri_hours, ':', pri_minutes, ' ', if(pri_ampm = 1, 'am', 'pm')) hr (`sms_primary`) order str_to_date(hr, '%h:%i %p') and use codeigniter wrote query below $this->db->select("*,concat(pri_hours,':', pri_minutes,' ',if(pri_ampm = 1,'am','pm')) hr",false); $this->db->from('sms_primary'); $this->db->order_by("str_to_date(hr,'%h:%i %p')"); but not getting expected query below select *, concat(pri_hours, ':', pri_minutes, ' ', if(pri_ampm = 1, 'am', 'pm')) hr (`sms_primary`) order str_to_date(hr, `'%h:%i` %p') i hope spot out difference in generated query. injection off unwanted operator `. want remove it.how that? change str_to_date(hr, `'%h:%i` %p') to str_to_date(hr, '%h:%i %p') codeigniter adding backticks. use

How do I locate a specific location in google map view (in android studio)? -

in application have few items of list. clicking on each list item navigates corresponding page. now have item named map view , want user clicks on it, should take map view page , locate address (i have mentioned in code) in map. how that? in fact haven't worked google map view before. this have tried: [i not allowed use intent]. dummycontent: ................................ ................................ static { // add 4 sample items. additem(new dummyitem("1", "shopping center details")); additem(new dummyitem("2", "homepage")); additem(new dummyitem("3", "contact")); additem(new dummyitem("4", "map view")); } ................................. .............................. itemdetailfragment: ................. .................... }else if(mitem.equals("4")){//4. map view /*locate following address

How to check if PayPal subscription is still on trial period -

i'm using getrecurringpaymentsprofiledetails endpoint of paypal classic api retrieve information subscription. data, endpoint, how determine if customer still on initial trial period , not yet on regular billing period? the account on trial, if trialtotalbillingcycles > numcyclescompleted , is, if have completed less cycles there trial cycles.

java - Can't connect to Sql Server database using JDBC -

Image
i'm trying make connection existing database in sql server 2012n netbeans 8. using connection wizard select sql server 2012 , enter credentials , fields. however message connection cannot established. you can see screenshots of entered fields: i tried using "localhost" instead of "stijn" didn't work. tried default port "1433". didn't worked, port should be? can see port i'm using? maybe error lies in port, otherwise wouldn't know made mistake. go sql server configuration manager -> sql server network configuration -> protocols sqlexpress -> tcp/ip (double click on properties). on protocol page set enabled yes. on ip addresses page, scroll bottom. tcp dynamic ports: 54629 tcp port: 1433 apply , ok. make connection with: host: localhost port: 1433 credentials instance field = blank. this should work.

java - Retrieve a list of file resource thru Drive Api -

i using drive api retrieve list of files google drive using java code: files.list request = services.files().list(); list<file> result = new arraylist<file>(); { try { filelist files = request.execute(); system.out.println("getalternatelink::"+files.getitems().get(0).getalternatelink()); result.addall(files.getitems()); request.setpagetoken(files.getnextpagetoken()); } catch (ioexception e) { log.log(level.warning, "an error occured: ", e); request.setpagetoken(null); } } while (request.getpagetoken() != null && request.getpagetoken().length() > 0); using getalternatelink method, got this url. my question how write code '/ spreadsheet ' location instead of ' /file ' in url. i.e - https://docs.google.com/a/test.com/spreadsheet/d/0ivwrm7safgdrv9ruzrrbms/edit?usp=drivesdk you /spreadsheet url if file google spreadsheet. if general file or ms exc

javascript - Get list element with JQuery according to its value -

assume have following list: <ul class="pagination pagination-sm"> <li><a href="#">ru</a></li> <li><a href="#">ro</a></li> </ul> with jquery, want select list element has value ru . how can achieve this? alternative solution in 1 line ;) var ru = $("ul li a:contains('ru')").text(); // demonstration purposes $('.tron').text(ru); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <ul class="pagination pagination-sm"> <li><a href="#">ru</a></li> <li><a href="#">ro</a></li> </ul> <!-- demonstration purposes --> <h1 class="tron"></h1>

How do I implement a food generator in a snake game (using c++ and OpenGL) that is not grid-based? -

the snake in game list of squares. each square in list defined using gl_quads, requires definition of 2 vertices (x,y , x1,y1) so: void square::draw() const { glbegin(gl_quads); glvertex2f(x, y); glvertex2f(x1, y); glvertex2f(x1, y1); glvertex2f(x, y1); glend(); } the snake moves insertion of new element @ front of list, , deletion of last. so, if snake moving towards left, , receives command move upwards, square created above snake's (previous) head, , last square in list removed. to generate food, have following code: void generate_food() { time_t seconds time(&seconds); srand((unsigned int)seconds); x = (rand() % (max_width - min_width + 1)) + min_width; y = (rand() % (max_height - min_height + 1)) + min_height; x1 = foodx + 10; y1 = foody + 10; food = new square{x,y,x1,y1 }; } (note: width , height dimensions of playfield.) i implemented function grows snake: if coordinates of snake'

vba - Access 2010 Login Form won't close itself -

i have database login form, , upon successful login main navigation form supposed open , login form supposed close... except login form refuses close , instead throws "run-time error '2585': action can't carried out while processing form or report event." here's i've got code: private sub buttonlogin_click() dim hash new cmd5 dim salt string dim result string dim rs dao.recordset dim rc dao.recordset set rs = currentdb.openrecordset("tblcurrentuser", dbopendynaset) set rc = currentdb.openrecordset("tblcustom", dbopendynaset) '----check if user id or password null---- if isnull(id) msgbox "please enter user id", vbokonly me.id.setfocus exit sub end if if isnull(password) msgbox "please enter password", vbokonly me.password.setfocus exit sub end if '----validate login information---- ' section builds salted md5 hash , compares ' password stored in personnel table. result

vb.net - visual studio web service response return nothing -

i trying call webservice visual studio (vb 2013). tried call webservice soap ui , returning response correctly. added web reference vb code , tried call webservice doing below: dim s new localhost.protoservice dim ws_req new localhost.newuserrequest dim ws_response new localhost.newuserresponse ws_req.fullname = textbox1.text ws_response = s.newuser(ws_req) the ws_response returning nothing, though webservice @ server side has completed successfully. validated namespaces in reference code , seems ok, thoughts? thanks. i turned out namespace should empty in response, when set [namespace]:="" worked fine, hope whoever faced problem.

How to Forward $scope from Controller to Controller AngularJS? -

i new angular js. is possible forward scope of restaurantcontroller menucontroller code follows example :- angular.module('restaurants').controller('restaurantcontroller', ['$scope', function($scope) { $scope.restaurantid="435scvcxvbrcvbnvn"; } ]); and assigned restaurant id new scope in menu controller follows angular.module('menus').controller('menucontroller', ['$scope', function($scope) { $scope.currentrestaurantid= $scope.restaurantid; alert($scope.currentrestaurantid); // showing null } ]); the restaurant id not persisted .. feel thing missing . how id restaurant controller menu controller ? try inheritance angular.module('restaurants', []); angular.module('menus', ['restaurants']); angular.module('restaurants').controller('restaurantcontroller', function($scope) { $scope.restaurantid=&quo

core data - How can I check which class declares a property from a NSAttributeDescription variable? -

myclassa inherits nsmanagedobject. myclassb inherits myclassa. myclassa has property, let's call classaprop. myclassb has property, let's call classbprop. i have instance of myclassb, myclassb. want loop through managed attributes of instance this: [myclassb.entity.attributesbyname enumeratekeysandobjectsusingblock:^(nsstring *key, nsattributedescription *attribute, bool *stop) {}]} so within block, each attribute (classaprop, , classbprop) how can check if myclassa or myclassb declared properties. within block, if @ [attribute description] see like: proxy prop named classaprop on ed myclassb, real (<nsattributedescription: 0x7fce49536be0>), name classaprop, isoptional 0, istransient 0, entity myclassa, renamingidentifier classaprop, validation predicates ( ), warnings ( ), versionhashmodifier (null) userinfo { }, attributetype 800 , attributevalueclassname nsnumber, defaultvalue 1 internally seems it's possible access declaring class, can't

c# - cannot find controls in gridview and get an error(Index was out of range) -

actually have problem finding linkbutton control in gridview . have 2 gridviews 1 of them inside 1 problem cannot value of linkbutton of second gridview, here code <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" borderstyle="none" datasourceid="sqldatasource2" gridlines="none"> <columns> <asp:templatefield showheader="false"> <itemtemplate> <table align="center" class="table3"> <tr> <td > <asp:label id="lblid" runat="server" visible="false" text='<%# eval("food_id") %>'></asp:label> <b> <%#eval("title")%></b> </td> </tr>

image - android studio screen size not same on emulator -

helloo im making project on android studio.my workbench screen size not same working on emulator in phone when trying in android studio when developing i got scroolview vertical ann got linear layout in scrollwiew.i want make same every phone. my menu.xml <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scrollview" > <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="chosse one!" android:id="@+id/textview2" android:layout_alignparenttop="true"

xamarin.ios - why does xamarin suddenly not let me deploy to iOS devices -

this started happening today after got message xcode agree new t&c's. i can't put on device, on of computers. doesn't work on macbook, doesn't work on mac mini, doens't work existing projects worked fine until yesterday, doesn't work new projects. message: writedicttofile:1241 open failed /users/georgecook/desktop/test/ios/obj/iphone/debug/mtouch-cache/install-shadow-directory/339bee33bc83c8e05fbd004dcc732c0b/20715d40747e047ba8a4ce4c1d2672ef90161df5/manifestcache.plist : no such file or directory mdmcachedirectorymanifest:1315 writedicttofile failed write /users/georgecook/desktop/test/ios/obj/iphone/debug/mtouch-cache/install-shadow-directory/339bee33bc83c8e05fbd004dcc732c0b/20715d40747e047ba8a4ce4c1d2672ef90161df5/manifestcache.plist : no such file or directory error mt1006: not install application '/users/georgecook/desktop/test/ios/bin/iphone/debug/test.ios.app' on device gandalf white: application failed code-signing

java - Multiple Input Files In one Mapper Class Hadoop? -

so,i trying code fp-tree algorithm in mapreduce paradigm, creating frequent item set list , have following problem : input: file1.txt (contains transactions) 123 452 221 12 45 76 987 77 76 123 354 [each line contains items bought in 1 transaction] file2.txt (contains items bought in descending order) 12 123 6 221 5 77 4 354 [count] [item id] output : output.txt 123 221 123 77 354 [2nd transaction eliminated] items according count taken in ( descending ), others deleted is possible take both file1.txt , file2.txt 1 mapper class ? because solve problem or there way perform operation in way ? any appreciated. look mapreduce distributed cache example.may full http://myhadoopexamples.com/2014/04/16/hadoop-map-side-join-with-distributed-cache-example/ read file in setup method.the above link give guidance. hadoop map reduce read text file

How to create sub folder in android studio -

how create user defined folder in android studio example create mylayout folder in res folder , create xml file same name created in layout folder. mean duplicate file want create xml file same name message show xml file must unique. you can't it, time can create duplicate layout files when within predefined folder names. res/layout-v14 api 14+, res/layout-v21 api 21+, etc , else.

c++11 - intersection of n vectors -

i'm new programming , i've come across issue finding intersection of n vectors, (int vectors) have sorted ints. approach came has complexity of o(n^2) , using std::set_intersect function. the approach came having 2 vectors: first vector correspond first vector have, , second second vector. call set intersection on 2 , overwrite first vector, use vector clear function on second. overwrite next vector second, , repeat process, , returning first vector. i believe there more efficient way of going this, @ moment, can not think of more efficient manner. on issue appreciated. fortunately, think tighter bound can placed on complexity of algorithm. the complexity of std::set_intersection on input sets of size n1 , n2 o(n1 + n2). take original vectors , intersect them in single-elimination tournament style, is, on first round intersect 1st , 2nd vectors, 3rd , 4th, 5th , 6th, , forth; on second round intersect 1st , 2nd intersections, 3rd , 4th, , forth; repeat unti

c++ - Why is string::resize linear in complexity? -

the string needs delete old memory, declare new memory buffer, both of o(1) in complexity. cplusplus.com reference says linear in time complexity of new string length . because old string needs copied over? if start empty string? basically want string declared size n buffer, in o(1) time. possible? every element of new string initialized, either moving old elements, or making copies of second argument of std::string::resize (which defaults chart() ). therefore number of initializations (new length). one imagine future improved allocator allowed in-place adjustment of block size (like realloc c library), additional memory might found contiguous old, , max(0, (new length) - (old length)) initializations needed. current allocator scheme doesn't support such.

python - How to list the queued items in celery? -

i have django project on ubuntu ec2 node, have been using set asynchronous using celery . i following http://michal.karzynski.pl/blog/2014/05/18/setting-up-an-asynchronous-task-queue-for-django-using-celery-redis/ along docs. i've been able basic task working @ command line, using: (env1)ubuntu@ip-172-31-22-65:~/projects/tp$ celery --app=myproject.celery:app worker --loglevel=info i realized, have bunch of tasks in queue, had not executed: [2015-03-28 16:49:05,916: warning/mainprocess] restoring 4 unacknowledged message(s). (env1)ubuntu@ip-172-31-22-65:~/projects/tp$ celery -a tp purge warning: remove tasks queue: celery. there no undo operation! (to skip prompt use -f option) sure want delete tasks (yes/no)? yes purged 81 messages 1 known task queue. how list of queued items command line? if want scheduled tasks, celery inspect scheduled to find active queues celery inspect active_queues for status celery inspect stats for commands

Math in Django to get a total returned -

i'm trying result tells me 10.5 hours worked on project. here's i'm doing in view: time = time.objects.filter(my_company=my_company, project=project) raw_hours = time.aggregate(sum('hours')) raw_minutes = time.aggregate(sum('minutes')) adj_minutes = raw_minutes.raw_minutes__sum / 100 hours = adj_minutes + raw_hours.raw_hours__sum return {'hours': hours} when add {{ view.hours }} template, i'm not seeing in return. i'm expecting view.hours == 10.5 or depending on math. so have 2 questions. thinking correctly , there more efficient way this? thanks help. you can both aggregates doing: d = time.aggregate(sum('hours'), sum('minutes')) this should return dictionary looks this: {'hours__sum' : decimal('10'), 'minutes__sum' : decimal('630')} so access values should deal same way deal other dictionary. hours = d['hours__sum'] on template, need provide key con

javascript - Creating a picture slider for a website -

i trying create picture slider on website i'm building. when searching examples online, i've found complex examples great amounts of javascript code or suggestions use dreamweaver-type software. isn't there simple, html5 integrated/built-in way create picture slider? try out slick plugin, it's useful carousels. documentation here: http://kenwheeler.github.io/slick/ add <head> tag initialize plugin default style: link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.4.1/slick.css"/> // add slick-theme.css if want default styling <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.4.1/slick-theme.css"/> then before </body> tag do: script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.4.1/slick.min.js"></script> example: html <div data-slick='{"slidest

javascript - How can I get li items to slide and/or fade into view on this jQuery list? -

okay, have input textarea when hit enter on it, list item word appears. when hit x on list item, slides out of view (i able figure out). but can't figure out how make list items slide down view when hit enter -- instead, appear suddenly, think looks bad. how make list items gracefully slide view when hit enter? http://jsfiddle.net/mlynn/vxzc6z6y/ html <!doctype html> <!-- --> <html lang="en"> <head> <link type="text/css" rel="stylesheet" href="css/styletime.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="js/init.js"></script> </head> <body> <section id="heady"> <div style="width:1000px;margin-left:auto;margin-right:auto;"> <div style="text-alig

Python socket giving connection refused only on browser -

as know app 100% not work, test, expecting other error other connection refused on browser, don't log browser tried connect! made me think before making work need see why gets refused(i'm doing experiment http!) note: use socket not http libraries, , problem exists on browser , not client app wrote other answers won't me code: #!/usr/bin/python # server.py file import socket # import socket module s = socket.socket() # create socket object host = socket.gethostname() # local machine name port = 1234 # reserve port service. s.bind((host, port)) # bind port s.listen(5) # wait client connection. while true: c, addr = s.accept() # establish connection client. print 'got connection from', addr c.send(open("gpioweb/index.html").read()) print c.recv(1024) c.close() # close connection client : #!/usr/bin/python # client.py file import soc

javascript - Manipulate Data with JSON using Angular JS for WordPress JSON API -

i tested code in this post , modified bit use. cannot json object api of blog have generated using wordpress json plugin. url api blog (not working): http://teckstack.com/api/get_recent_posts url w3c example (working): http://www.w3schools.com/website/customers_json.php i stuck when tried manipulated json api blog (mentioned above) , same code worked other url provided w3c example? please provide suggestion. i using below codes in .html file , not in wordpress environment . ==== angular js script ==== (function() { var app = angular.module('tsapp', []); app.controller('tscontroller', function($scope, $http) { $scope.heading = []; $http({ method: 'get', url: 'http://teckstack.com/api/get_recent_posts' }).success(function(data) { console.log("pass"); $scope.heading = data; // response data }).error(function(data) { console.l

php - Automatically Mark Up HTML Text -

i hoping find way automatically mark html document based on text matches. have directory containing several hundred short html documents, contents of individually included (via php) in base_document.html depending on value of variable taken url, so: <?php include $_get['id'] . ".html";?> if included html document contains specific word, e.g. "dangerous," automatically format particular markup; example: <strong>dangerous</strong> is there particular library or function in php, javascript, and/or css provides kind of functionality? or need write own code achieve purpose? edit: there long list of target words , associated markups, assume need refer custom dictionary residing in either file or database. e.g., "dangerous",bold "important",style:color=red "hungry",em "hot",strong this example, must adapt case: <?php $data[] = 'dangerous,bold'; $data[] = 'import

multithreading - Threads are not joined properly in Idle -

i trying create work , thread pool. each thread pool tries pick work untill work empty. threads join. when run program in idle, seems threads not joining (sometimes executes properly). threads not participate in picking work properly. edit:but when run same in command shell, works fine. below related code. import threading import time threads = [] work = range(1000) lock = threading.lock() def f(): global work th = threading.currentthread() name = str(th.getname()) while true: lock.acquire() try: size = str(len(work)) ## print "\n inside "+ name +" "+ size + "\n" if size!="0": w = work.pop() else: break finally: lock.release() print "\n"+ name +" "+ size + "\n" start1 = time.time() in range(10): t = threading.thread(target = f) threads.append(t) t.star

flex - actionscript 3: border for label of progressbar not working -

is there know how make border label of progress bar in action script 3? tried setstyle("bordercolor",#ff0000) it's not success. in example code of documentation see styles initialized notation 0xaab3b3 . i suggest change color in function 0xff0000 . the 0x means it's hexadecimal number.

php - Google Cloud Storage One file multiple access at the same time -

i'm using googlecloudstorage in gae-projekt , know happens when access 2 instances 1 file @ same time. created php-script, opens file, read it's content, add content , save this: $usercontent = json_decode(file_get_contents("*** link ***")); $usercontent->abc = "test"; // changes file_put_contents("*** link ***", json_encode($usercontent); my worry while open file, instance opens , data gets lost. happen in case? is file locked , other instance waiting? is file locked , other instance aborts? is data getting lost? google cloud storage, per se, imposes no locking. both reads , writes gcs objects atomic -- each read contents of object entirely 1 version; each write totally replace object. no "intermediate stage" (with part of object being 1 version , rest version) can ever possibly exist. but of course is quite possible "lose data" if multiple tasks attempting "modify" gcs object independe

Java loop is not terminating -

can tell me why loop continuous? while(sum !=7 || sum!=pt){ system.out.println(sum); die1.roll(); die2.roll(); sum = (die1.getnumber() + die2.getnumber()); joptionpane.showmessagedialog(null, "the sum of numbers "+sum); } even if sum equal 7 or variable pt loop keep on going reason. change || && . loop continue while 1 of conditions evaluates true. in order make stop when 1 becomes true, need change boolean operator.

docker - Container cannot be started from bootlocal.sh -

running boot2docker 1.5.0 under windows. container gastrobase exists , can started manually docker start gastrobase . when put command /var/lib/boot2docker/bootlocal.sh , upon startup post http:///var/run/docker.sock/v1.17/containers/gastrobase/start: dial unix /var/run/docker.sock: no such file or directory. trying connect tls-enabled daemon without tls? time="2015-03-28t19:50:51z" level="fatal" msg="error: failed start 1 or more containers" in var/log/bootlocal.log . running ./bootlocal.sh manually starts ok. i have tried sudo -variant, according thread in wrong choice boot2docker. this proved racing condition: following in bootlocal.sh startup works sleep 1 docker start gastrobase romansaveljev suggested docker run --restart=always --name gastrobase instead.

javascript - HTML5 - Canvas Element & Custom Cursor -

html5 document - canvas element not running javascript parameters customized 'rectangle' cursor. please :) <head> <title>canvas element & custom cursor</title> </head> <body id="body" style="background-color:red;"> <canvas id="canvas" width="600" height="400" style="background- color:white;"> </canvas> <script> funtion canvasproperties(){ var canvas = document.getelementbyid("canvas"); canvas = canvas.getcontext("2d"); window.addeventlistener("mousemove", customcursor, false);} function customcursor(){ canvas.clearrect(0,0,600,400); var xposition = clientx; var yposition = clienty; canvas.fillrect(xposition, yposition, 100, 100);} window.addeventlistener("load", canvasproperties, false); </script> </body> </html> there several issues here, pointed out

html - HTTP post array merging with PHP -

i have following question: i have following inputs: <input type="text" name="name[]" ... <input type="text" name="qty[]" ... <input type="text" name="value[]" ... what receive after posting is: 'name' => array (size=3) 0 => string 'book one' (length=8) 1 => string 'book two' (length=8) 2 => string 'book three' (length=10) 'qty' => array (size=3) 0 => string '1' (length=1) 1 => string '3' (length=1) 2 => string '1' (length=1) 'value' => array (size=3) 0 => string '10' (length=5) 0 => string '30' (length=5) 0 => string '25' (length=5) because of cannot foreach, , doing , index not nice way. :( i merge into: 'items' => array (size=3) 0 => array('name' => 'book one', 'qty' => '

string - Why CKEditor ignores empty div or is it something else? -

i have written plugin adds bootstrap grid editor.however seems ckeditor deletes whole wrapping col div when there no content inside it. plugin on github: https://github.com/radko26/ckeditor_layoutmanagerplugin/tree/master/layoutmanager this default inside dom.when delete 'content', editor removes wrapping div-layout-column . <div class="container-fluid layout-container"> <div class="row layout-row"> <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 layout-column"> <p>content</p> </div> <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 layout-column"> <p>content</p> </div> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 layout-column"> <p>content</p> </div> </div> i read through documentation , althought div element not stripped on default, added config.protectedsource.

Excel VBA - very slow, and weird behaviour - Something else running? -

ok - excel vba - is running slow, , weird behaviour - else running? the text i'm typing gets "rearranged" automatically (ie. first letter type @ end of sudden) the text of current line i'm on turns red in middle of typing something, window pop "syntax error" before i'm done typing. i have turned off addins (i have tm1 - pain in rear end) i have optimised code using, , have been coding long time , there nothing should taking long... help!!! sub createcopy3() dim x long dim sumfilterno long dim m long dim delme long dim ncount long dim lrowc_dow dim newsh string dim mp long dim shdow dim shdata string dim shcons string dim shxx string dim shdowxx string dim sfilter string dim sfiltercol string dim sfiltercolnumber long dim shname string dim sfilterby string dim lrowc long dim lrowc_sum long dim lrowc_new long dim nicenam

php - How to fix this "undefined index" if statement -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 22 answers my code below $base = if((!empty(($_server['https'] ? 'https' : 'http') . '://' . $_server['http_host'] . '/')); i'm checking whether $_server['https'] not empty notice: notice: undefined index: https in d:\xampp\htdocs\flower-shop\flowers.php on line 24 the following code should work. if notice, in php shorthand don't include if word. <?php $base = (isset($_server['https']) ? 'https' : 'http').'://'.$_server['http_host'].'/'; ?> i not rely on $_server['http_host'] since can modified client , can cause huge issues.

ruby on rails - How to add a record -

im studying ruby on rails , found 1 question can't resolve. description: have ticket , comments. 1 ticket should have many comments. comments belong ticket should listed in ticket's "show" view. there text field , button "add new comment". after adding comment should rendered view "show" of current ticket. the problem: how send current ticket's id comments model saved comment , how render (or redirect?) view "show" of ticket comment's method "create"? my files: class ticket < activerecord::base has_many :comments end class comment < activerecord::base belongs_to :ticket end class ticketscontroller < applicationcontroller def show @ticket = ticket.find(params[:id]) @comment = comment.new end ...... class commentscontroller < applicationcontroller def create @comment = comment.new(params.require(:comment).permit(:text)) **@comment.ticket_id = @current_ticket_id*

ruby on rails - The action 'create' could not be found for SessionsController -

i'm new ruby on rails , i'm attempting create user login page. i'm using sessions. whenever open login page, loads, when try put in login information of user know exists, error unknown action action 'create' not found sessionscontroller my routes file looks this. note, i'm using teachers user class here. myapp::application.routes.draw root :to => 'home#index' 'teachers' => 'teachers#all' 'profile' => 'teachers#show' 'signup' => 'teachers#new' 'login' => 'sessions#new' post 'login' => 'sessions#create' delete 'logout' => 'sessions#destroy' resources :teachers end and sessions controller class sessionscontroller < applicationcontroller module sessionshelper def new @session=session.new end def log_in(teacher) session[:teacher_id] = teacher.id end def

android - Get list from database using ActiveAndroid -

new activeandroid (and overall android database). read documentation, have 1 problem. i have route.class , latlngposition.class. route made of more latlngposition nodes. so implementation is: @table(name="route") public class route extends model { @column(name="name") private string name; @column(name="time") private mytime time; public route(string name, mytime time) { super(); this.name = name; this.time = time; } public route(){ super(); } public list<latlngposition> getlatlnglist(){ return getmany(latlngposition.class, "route"); } ... } and latlngposition class: @table(name="latlng") public class latlngposition extends model { @column(name = "latitude") double latitude; @column(name = "longitude") double longitude; @column(name = "route", onupdate = column.foreignkeyaction.cascade, ondelete = column.foreignkeyaction.cascade) route route; public latlngpositio