Posts

Showing posts from September, 2011

ios - Google Cast Media Player Library - for streaming from Local Device -

despite reading documentation not not clear me " google cast media player library " , whether route need take chromecast app. what trying achieve play media local ios device on chromecast. main aim to play users videos , photos , not drm media. up till have been doing exporting avasset , passing file address simple http server. seems horribly inefficient , thought use avassetreader pass stream chromecast. during research came across terms mpeg-dash - smoothstreaming http live streaming (hls) but not understand whether need such complex implementations i find name - google cast media player library, ambiguous , there no concise explanation of is. https://developers.google.com/cast/docs/player this piece of definition given there: ... provides javascript support parsing manifests , playing http live streaming (hls), mpeg-dash, , smooth streaming content. provide support hls aes encryption, playready drm, , widevine drm. i hope not ambi...

windows runtime - Edit TextBox's Header property inside Style -

how customize textbox's header property inside styles winrt. i want change header's fontsize & foreground property inside style. i tried this: <style x:name="valuetextboxportraitstyle" targettype="textbox" basedon="{staticresource valuetextboxstyle}"> <setter property="borderthickness" value="6"/> <setter property="fontsize" value="18"/> <setter property="margin" value="0,0,0,10"/> <setter property="header"> <setter.value> <headertemplate> <datatemplate> <textblock text="{binding}" fontsize="10" foreground="green"/> </datatemplate> </headertemplate> </setter.value> </setter> </style> but gives error. added headertemplate property ...

html - How do i reposition the Nav of my wordpress website -

im newbie, working on wordpress website http:// www.smope.net, i'll love put "about us" menu directly under yellow smile in logo. i tried use google chrome's inspector locate css id , file, have not had success in aligning nav menu right i'll appreciate help apply following properties .main-navigation ul make this: you can use margin-left in css define distance between 2 objects horizontally. .main-navigation ul { list-style: none; margin-top: 0; margin-bottom: 0; margin-left: 230px; text-align: center; }

jsf - p:inputText in p:dialog return empty value -

i'm using p:inputtext inside p:dialog following: <p:dialog header="détails fournisseur" appendto="@(body)" widgetvar="dlg1" modal="false" height="300px"> <h:form> <h:panelgrid columns="3" cellpadding="20"> <h:panelgrid columns="2" cellpadding="5"> <p:outputlabel for="corporatename" value="raison sociale:" /> <p:inputtext id="corporatename" autocomplete="off" required="false" value="#{providerbean.corporatename}" /> <p:message for="corporatename" /> </h:panelgrid> ...

ios - Is it wise to export a Tiled layer into 1 big png file to save memory? -

Image
i made background layer in tiled map sprite kit. main layer background layer grass, dirt, water & lot drawn - player character "walks on". map consisted of tiles 16x16 (keeping them small having better control on little details during design of map). map self 100x100. it's pretty decent size wise. have between 757-778 nodes because of these background tiles. that's , haven't added single tree second layer. since i'm using tiled map editor jstilemap display it, can somehow export ready background layer tiled .png file , load game 1 big picture drop node count 1. wouldn't drastically performance , memory? others layers have images spread across & there's layer that's responsible boundaries. clever way of going making game or missing something? if is, know how export layer .png file? checked tiled & couldn't find that. you better off having single png/node background. there benefits of doing this: you have 1 node. you ...

c++ - Why don't I get any output? -

i trying write first oop code in c++, reason not getting output. trying create class contain method getsquare() accept int n , returns number squared. can tell me doing wrong? #include <iostream> using namespace std; class myclass { public: int square; void getsqure(int n); }; void myclass::getsqure(int n) { int square = n * n; } int main(){ int n = 5; myclass c; c.getsqure(5); cout << endl; return 0; } your getsquare function doesn't anything, defines variable square (does not return though). make return int , like int myclass::getsqure(int n) { // make sure change declaration int square = n * n; return square; } then cout << c.getsquare(5) << endl; and you'll have output.

Change route path in Rails -

i have resource change path of. resources :blog_posts that makes path localhost:3000/blog_posts/:id how make instead of having "blog_posts" in front of it, id comes right after, this? localhost:3000/:id i'm guessing there's way make dynamic, don't have get every new blog post. answer get '/:id', to: 'blog_posts#show', as: :show_blog_post you need as: :show_blog_post because prefix won't there. example, you'll able call show_blog_post_path(@blog_post) you can define route like: get '/:id', to: 'blog_posts#show'

java - Solve algebraic Equation -

this question has answer here: how compare strings in java? 23 answers i've created random question generator. questions in form: x=3/random number. problem program never recognizes fact user's answer correct. i've made print out answer , copy answer input (text pane), yet prints out "wrong." private void jbutton1actionperformed(java.awt.event.actionevent evt) { //generates random value n (2 decimal plcae) double nmin = 1.0;//minimum double nmax = 38.6;//maximum random rn = new random(); double nrand = nmin + (nmax - nmin) * rn.nextdouble(); //calculates corresponding value of v string x = string.format("%.2f", 3/nrand ); double nans = double.parsedouble(x);//corresponding value of c check.settext(x); //displays question question.settext(...

decorator - Why does @foo.setter in Python not work for me? -

so, i'm playing decorators in python 2.6, , i'm having trouble getting them work. here class file: class testdec: @property def x(self): print 'called getter' return self._x @x.setter def x(self, value): print 'called setter' self._x = value what thought meant treat x property, call these functions on , set. so, fired idle , checked it: >>> testdec import testdec testdec import testdec >>> t = testdec() t = testdec() >>> t.x t.x called getter traceback (most recent call last): file "<stdin>", line 1, in <module> file "testdec.py", line 18, in x return self._x attributeerror: testdec instance has no attribute '_x' >>> t.x = 5 t.x = 5 >>> t.x t.x 5 clearly first call works expected, since call getter, , there no default value, , fails. ok, good, understand. however, call assign t.x = 5 seems create new prope...

.net - How to get string parts using the variable name -

i have program written in vb.net contains lot of variables similar each others. example, 1 of them is public shared iphone4s_firmware_8_0_key = key as can see, variables composed model of iphone (iphone 4s/5, etc.) , firmware version (8.0/8.0.1, etc.) now, when user selects combo of 'device' + 'firmware', tool has export right variable (depending user's choice) in string called 'active'. i manually if/then combination, mess. i'd proceed in way: dim active string = iphonemodel + "_firmware" + version + "_key" as can guess, 'iphonemodel' , 'version' 2 other strings. in way can compose right variable dynamically, problem if write dim active string = iphonemodel + "_firmware" + version + "_key" it thinks 'iphonemodel + "_firmware" + version + "_key"' content of new variable. how can program has take content existing variable name; , not take name variable...

c# - RichTextBox change text on drag or drop -

i trying add newline when drading text 1 richtextbox another. have text in draggedtext, seems nothing happening. no newline appears. every dragge text richtextbox should in new line. xaml: <richtextbox x:name="first" previewdragenter="dragenter_executed"> c# private void dragenter_executed ( object sender, drageventsargs e ) { var draggedtext = environment.newline + e.data.getdata( dataformats.text ).tostring(); e.data.setdata ( draggedtext ); } well, couple of things. first, dragenter ..when drag enters area ... you'll change mouse icon, , maybe show preview of dropping if you'll drop it. the real magic happens on drop event, 1 in charge of doing changes because dropped object target area. you'll want append text other textbox (are sure want replace it?), , continue on whatever need do. you can have @ official msdn page more

java - The logic is always failing -

it's part entering date 27 june ( have logic correct) , still prints date not correct(logic fails). i don't understand why still failing. **code:** scanner date = new scanner(system.in); scanner month = new scanner(system.in); system.out.println("enter date"); int dat = date.nextint(); string mon= "june"; //string month="feb"; system.out.println("now enter month"); string mont= month.nextline(); if (dat== 27 && mont==mon) { system.out.println("yes thats correct date"); } else { system.out.println("no thats not correct date"); } you need compare objects (including strings) using equals() instead of == : if (dat== 27 && mont.equals(mon)){ // ... }

Android OpenGL Fatal signal 11 (SIGSEGV), code 2 -

i'm getting error fatal signal 11 (sigsegv), code 2, fault addr 0xa4b7b000 in tid 10818 (glthread 54114) when app starts up. i'm testing rendering lots of points. it's crashing 10,000 points , worked fine 3,000. public class pointrenderer implements glsurfaceview.renderer { private int size = 10000; private floatbuffer floatbuffer; public void onsurfacecreated(gl10 gl, eglconfig config) { floatbuffer = bytebuffer.allocatedirect(4*2*size).asfloatbuffer(); random r = new random(); (int = 0; < 2*size; i++) { floatbuffer.put(r.nextfloat()*100); } } public void onsurfacechanged(gl10 gl, int w, int h) { gl.glviewport(0, 0, w, h); } public void ondrawframe(gl10 gl) { gl.glclearcolor(0.0f, 0.0f, 0.0f, 1.0f); gl.glclear(gl10.gl_color_buffer_bit | gl10.gl_depth_buffer_bit); gl.glpushmatrix(); gl.glcolor4f(1.0f, 0.0f, 0.0f, 1.0f); gl.glenable...

Test if all elements are in another list in Python -

i want test if reference_list contains of items in required_strings . required_strings = ['apple','banana','carrot'] reference_list = [['apple','tree'], ['banana','grass'], ['carrot','grass']] i want true or false test result. expected answer 'true'. this had attempted: test = [i in reference_list if any(s in s in required_strings)] print test you can making use of set , itertools.chain . we're going take advantage of set theory , regard required_strings , reference_list sets, , demonstrate required_strings <= reference_list ; is, required strings set contained inside of reference list. first, use itertools.chain flatten shallow list. from itertools import chain chain(*reference_list) # iterable object next, turn both chained list , tested list sets , compare see if 1 set contained in other. from itertools import chain set(requi...

android - Which thread(s) call `onCreateLoader()` and `onLoadFinished()`? -

i implementing loadermanager.loadercallbacks in order access app's database , populate listview . threads call oncreateloader() , onloadfinished() ? called on ui thread or cursorloader 's thread? documentation loadercallbacks mute on point. loader callback called on thread initloader method called. in general main thread.

mapreduce - In Spark, does the filter function turn the data into tuples? -

just wondering filter turn data tuples? example val fileslines = sc.textfile("file.txt") val split_lines = fileslines.map(_.split(";")) val filtereddata = split_lines.filter(x => x(4)=="blue") //from here if wanted map data using tuple format ie. x._3 or x(3) val bluerecords = filtereddata.map(x => x._1, x._2) or val bluerecords = filtereddata.map(x => x(0), x(1)) no, filter take predicate function , uses such of datapoints in set return false when passed through predicate, not passed out resultant set. so, data remians same: fileslines //rdd[string] (lines of file) split_lines //rdd[array[string]] (lines delimited semicolon) filtereddata //rdd[array[string]] (lines delimited semicolon 5th item blue so, use filtereddata , have access data array using parentheses appropriate index

c++ - Installing twitcurl on OS X -

i attempting install twitcurl on os x , have met problems. at first, running make return clang error: ld: unknown option: -soname . looked through responses other users similar problems on os x , found following advice: in makefile, change: ldflags += -wl,-rpath-link=$(staging_dir)/usr/lib to: ldflags += -rpath=$(staging_dir)/usr/lib change: $(cc) -shared -wl,-soname,lib$(libname).so.1 $(ldflags) -o lib$(libname).so.1.0 .o -l$(library_dir) -lcurl to: $(cc) -dynamiclib -shared -wl,-install_name,lib$(libname).dylib.1 $(ldflags) -o lib$(libname).dylib .o -l$(library_dir) -lcurl i tried this, result clang error: clang: error: unknown argument: '-rpath=/usr/lib' any advice towards installing twitcurl on os x system appreciated. ----update---- i wanted put in 1 place steps took make work, in case os x users similar problems come across in future. andy piper crucial pieces. open makefile , replace: ldflags += -wl,-rpath-link=$(staging_dir)/usr/lib ...

python - How to make a Socket.IO client connect to a Python3 Websocket server -

i'm attempting socket.io client connect python websocket server created using aaugustin's websockets library , asyncio. using example on page created following web socket server: import asyncio import websockets datetime import datetime @asyncio.coroutine def producer(): return str(datetime.now()) @asyncio.coroutine def handler(websocket, path): while true: message = yield producer() if not websocket.open: break yield websocket.send(message) yield asyncio.sleep(3) start_server = websockets.serve(handler, "localhost", 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() the view served using flask , looks following: <!doctype html> <head> <title>websocket client test</title> </head> <body> <script src="https://cdn.socket.io/socket.io-1.3.5.js"></script> <script> console.log...

css - WebGL Walkthrough, Move around the 3D scene -

i'm new webgl, , i'm trying create walk-through website, have taken maya model webgl of inka3d, when apply following code movement, doesn't work explains. left arrow works fine. function resize() { var width = canvas.offsetwidth; var height = canvas.offsetheight; canvas.width = width; canvas.height = height; aspect = width / height; } var cameratargetx = 37.2878151; var cameratargety = 12.846137; var cameratargetz = 7.17901707; var dx = 5; var dy = 5; window.addeventlistener('keydown',dokeydown,true); function dokeydown(evt){ switch (evt.keycode) { case 38: /* arrow pressed */ if (cameratargety - dy > 0){ cameratargety -= dy; } break; case 40: /* down arrow pressed */ if (cameratargety + dy < height){ ...

when should groupByKey API used in spark programming? -

groupbykey suffers shuffling data.and groupbykey functionality can achieved either using combinebykey or reducebykey.so when should api used ? there use case ? according link below, groupbykey should avoided. avoid groupbykey

cassandra - How exactly batch work in cql -

i going through datastax cql java driver 2.1 driver document , through cql 2.x reference pdf: in cql reference pdf: batches atomic default. in context of cassandra batch operation, atomic means if of batch succeeds, of will. in cql java driver pdf: batch operations batch statement combines multiple data modification statements (insert, update, delete) single logical operation sent server in single request. batching multiple operations ensures these executed in atomic way: either succeed or none. so understood first, batch success if single query inside batch sucess. from second understood batch failed if single query inside batch fails so exact thing ? the purpose of logged batches atomicity. if 1 query in batch fails entire batch fail , if batch succeeds, means every query in batch succeeded. either succeed or none accurate.

bash - How to check if the user has entered a single letter? -

i reading character , want check if single character , letter. code below: #!/usr/bin/bash read -p "enter something: " char if [[ ${#char} != 1 && "$char" != *[a-z]* ]]; echo "not valid input" else echo "its valid input" fi the o/p below: [root@host-7 ~]# sh -x t + read -p 'enter something: ' char enter something: 1 + [[ 1 != 1 ]] + echo 'its valid input' valid input while executing script first condition getting executed , not checking second condition. it not evaluating 2nd condition because first condition failing you're entering 1 character in input , there && between 2 conditions. if enter 2 character input ab you'll see both conditions getting evaluated. you can use -n1 restrict input 1 character this: #!/usr/bin/bash read -n1 -p "enter something: " char echo if [[ "$char" != *[a-z]* ]];then echo "not valid input" else echo ...

how to get Azure point-to-site client to connect to an Azure VM -

i have created azure virtual network point-to-site connectivity enabled. the point-to-site address space 10.0.0.0/24 (10.0.0.1 - 10.0.0.25). the virtual network address space 10.0.1.0/24 (10.0.1.4 - 10.0.1.254). i added azure vm, , assigned ip of 10.0.1.4. i created client vpn package , installed on machine. creates ppp adapter ip address 10.0.0.1. as result can't ping / connect client 10.0.0.1 vm 10.0.1.4. how should work? need other routing or should have somehow ended client , vm in same subnet? should have set dns? it simple - windows vms have default firewall enabled (as default windows server installations). , windows firewall blocks icmp packets (which ping) packets. you can test connectivity vm trying remote desktop targeted vm. or disable windows firewall.

java - How to get the minimum element from a priority queue after modifying the contents of queue -

this question has answer here: updating java priorityqueue when elements change priority 3 answers i trying implement dijkstra's algorithm using priority queue in java.. unfortunately returning wrong results...i have tracked down problem. here's problem..after inserting node weights queue,i modifying node weight,but when try remove element priority queue ,its returning historical minimum (minimum @ time of insertion). remove() doesn't know priority queue has been modified..any appreciated ...thanks! note:i can add source code if required this question should you. drawback priorityqueue in java if inserted element value changes, priority queue not re-constructed reflect new order. have remove , re-insert changing elements satisfy use case.

typeahead.js - Bloodhound identify bug? -

i'm using latest version of typeahead.js (v0.11.1). observed strange behaviors when using different ids dataset values. i've created jsfiddle . here's js code: var ds = new bloodhound({ datumtokenizer: bloodhound.tokenizers.obj.whitespace('name'), querytokenizer: bloodhound.tokenizers.whitespace, local: [{id: 1, name: "a b 1"}, {id: 2, name: "a b 2"}, {id: 3, name: "a"}], identify: function(obj) { return obj.id; } }); $('#go').typeahead(null, { name: 'ds', display: 'name', source: ds }); now typeahead may malfunction if change data 'local'. here examples: using 1 of these values 'local' (notice third element random numbers starting '1'): [{id: 1, name: "a b 1"}, {id: 2, name: "a b 2"}, {id: 15, name: "a"}] [{id: 1, name: "a b 1"}, {id: 2, name: "a b 2"}, {id: 1849, name: "a"}] now whe...

python - Why Pycharm print less than writing to a file? -

i testing following code, found output after "print" inconsistent text file. have set encoding "utf-8". bug? how fix? import requests url = "http://www.aastocks.com/tc/stocks/analysis/company-fundamental/financial-ratios?symbol=0001&period=4" r = requests.get(url) print r.content f = open("test.txt","w") f.write(r.content) there internal limit how many lines run console buffer can hold. limited 15k lines. to increase limit, you'll have change idea.properties file , add key idea.cycle.buffer.size , adjust accordingly. see this bug report solution detailed.

javascript - How to integrate Jquery with PHP -

when mouse on html button didn't happen anything, expect if mouse on button should show javascript working fine. there way achieve this. new javascript code may wrong. <!doctype html> <html> <head> <title>javascript</title> <script type="text/javascript"> $(document).ready(function(e) { $(".carts").mouseover(function(){ $(".minicart").css("display","block"); }); $(".carts").mouseleave(function(e) { $(".minicart").css("display","none"); }); } </script> </head> <body> <button class="carts"> add </button> <div style="width:400px;position:absolute;top: 34px;right: 166px;z-index: 99999; background-color:#ffffff; display:none" clas...

javascript - How to secure blueprint access in Sails.js -

so i'm pretty new sails.js seems bring lot table these blue prints, right have 2 models, accounts / friends it using association accounts has many friends on client side have way send notifications users, 1 being friends request works fine, gives user option accept or decline invite here's code: socket.on('accounts', function(data) { if (data.verb === "addedto" && data.attribute === "notifications") { socket.get('/notifications/' + data.addedid, function(note) { console.log(note); if (!$.isemptyobject(note)) { $scope.notifications.push({ 'text': note.from_name + ' sent friends request', 'id': note.id, 'type': note.type, 'from_id': note.from_id }) $.notify('you have new notification', 'info'); $scope.$digest(); } }) } }) $scope.ac...

php - Codeigniter input type text array validation -

html view form <div class="form-group"> <div class="col-lg-4"> <input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="tag or keyword" /> </div> <div class="col-lg-4"> <input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="tag or keyword" /> </div> <div class="col-lg-4"> <input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('ke...

android - Properly replacing Fragments -

i'm wondering proper way change fragments, add them backstack, , restore visibile fragment after screen rotation. currently, use method initialize first fragment: private void inflateinitialfragment() { fragmentmanager manager = getfragmentmanager(); fragment mainfragment = manager.findfragmentbytag(mainmenufragment.class.getsimplename()); fragmenttransaction ft = manager.begintransaction(); if (mainfragment == null) { ft.replace(r.id.maincontainer, new mainmenufragment(), mainmenufragment.class.getsimplename()); } else if (!(mainfragment.isadded() && !mainfragment.isdetached() && !mainfragment.isremoving())) { ft.replace(r.id.maincontainer, mainfragment, mainmenufragment.class.getsimplename()); } ft.commit(); manager.executependingtransactions(); } and display new fragments have methods one: public void openawards() { getfragmentmanager().begintransaction().replace(r.id.maincontainer, new awardsfragment(...

PHP - function that both returns and echoes a value -

i create function both returns , echoes value . not 2 together. or return or echo. , looking beautiful way it. functions / class methods in project must have option. i can pass function bool value indicates whether echo or return value seems not beautiful me. how, think, better implement this? maybe built-in option in php? passing boolean value way go, print_r same: mixed print_r ( mixed $expression [, bool $return = false ] ) if capture output of print_r(), use return parameter. when parameter set true, print_r() return information rather print it.

security - How to unlink file securly in php? -

i need delete image files in /var/www/mysite/postimage folder unlink() function in php. i'm absolutely worried if hacked site , using .. or . in path , try delete in upper level folder. i'm using jquery send path , because it's client side programming it's dangerous. know , can bypass dots when uploading files if changes path in client side adding dots it? question how prevent doing that? make sure apache user has proper rights(writing in website directory) cut .. path, sanitize , validate path if it's correct. you can use realpath() function.

html - Database won't update values with php form -

i trying make small form can update value database, won't work.. i've read different questions , answers on topic can't manage work. here's code: <?php include_once("php_includes/check_login_status.php"); $u = ""; $country = ""; if(isset($_get["u"])){ $u = preg_replace('#[^a-z0-9]#i', '', $_get['u']); } else { header("location: index.html"); exit(); } //a lot of other code other queries $sql = "select * users username='$u' , activated='1'"; $user_query = mysqli_query($db_conx, $sql); mysqli_query($db_conx,"update set country='$_post[country]' username='$_post[u]' "); if($result){ echo "succesful"; } else { echo "error"; } ?> <form method="post" /> ...

qt - QTreeView closes immediately -

i want display qtreeview when user choses qaction menu of mainwindow (which agendawindow in case). the issue when click on button display it, opens qtreeview , closes immediately. put infinite loop (while(1<2)) program blocked , couldn't find equivalent system("pause") . here function: void agendawindow::display_projects() { qstandarditemmodel* model = new qstandarditemmodel; qstandarditem *parentitem= model->invisiblerootitem(); (std::vector<projet*>::const_iterator =pm.getinstance().gettab().begin(); it!= pm.getinstance().gettab().end(); it++ ) { // display project qstandarditem* item=new qstandarditem(qstring((*it)->gettitre())); item->setflags(item->flags() & ~qt::itemiseditable); parentitem->appendrow(item); projet* p = (*it); // display every project's tasks (std::vector<tache*>::const_iterator itp = p->gettabprojet().begin(); itp != p-...

PHP Curl sent wrong Content-Type in post request -

i trying sent post request vendhq api using oauth2 auth method. i've correct code, client_id, client_secret etc work fine in postman when try sent same data using php curl, error: error 'error' => string 'invalid_request' (length=15) 'error_description' => string 'the request missing required parameter, includes invalid parameter value, includes parameter more once, or otherwise malformed. check "grant_type" parameter.' (length=179) this documentation of requesting access token , code trying access token. php code: $prefix = $vend[0]['domain_prefix']; $request_url = 'https://'.$prefix.'.vendhq.com/api/1.0/token'; $body['code'] = $vend[0]['code'];; $body['client_id'] = $vend[0]['app_id'];; $body['client_secret'] = $vend[0]['app_secret'];; $body['grant_type'] = 'authorization_code'; $body['redirect_uri'...

python - Gtk notifications don't display body holding '<' -

Image
i'm trying display notifications notification module of pygobject (version 3.16) in python. code works well, except when there < in body message. in case, body not displayed. for example code, ok: from gi.repository import gtk, notify def callback(notification, action_name): notification.close() gtk.main_quit() notify.init('test') notification = notify.notification.new('title', 'body') notification.set_timeout(notify.expires_never) notification.add_action('quit', 'quit', callback) notification.show() gtk.main() but 1 there problem: from gi.repository import gtk, notify def callback(notification, action_name): notification.close() gtk.main_quit() notify.init('test') notification = notify.notification.new('title', '<body') notification.set_timeout(notify.expires_never) notification.add_action('quit', 'quit', callback) notification.show() gtk.main() i that: when...

asp.net - ASP/C# - insert textbox in new line after other specific element -

i have page set of elements. dropdownlist1 create new textbox under specific element. example, if have (from top bottom): label1 dropdownlist1 textbox1 dropdownlist2 label2 i dropdownlist1 create textbox2 under dropdownlist2 when user selects item in dropdownlist1 . how can accomplish this? try give texbox2 display="none" property in css , place want. create method, set css property example 'inline-block' after assigning non-default value variable dropdownlist1 set.

php - Login and registration system using drupal - when user is created an email at our domain is also created -

i have experience of year in websites developing, php, mysql, javascript. , want move on using drupal, know cms. question follow in bit before ask, i'm trying now. so, im developing website administrator can create account @ company's website employee. when account created username password handed employee email @ website domain same password 1 username. example, employee john added website admin. john has username of lets jhon, password 123pass , email address jhon@comanpydomain.com same password. so question is, there functionality drupal use such task of creating username @ database of website , using kind of api of web host create email pragmatically @ same time username created. if there template of add website inbox employee send , receive emails. drupal has hook_user_insert can leverage , write custom module create post box user if web host provides api. exampe cpanel has api method addpop create new email account.

scala - Eclipse shows errors in Play 2.4 setup -

i trying setup scala sdk eclipse-based ide work play 2.4 on windows 8. followed instructions given on the official guide , after opening default view index.scala.html, bunch of errors like: ambiguous reference overloaded definition, both method display in class basescalatemplate of type (o: any)(implicit m: manifest[error]) , method display in class basescalatemplate of type (x: error) match argument types (play.twirl.api.htmlformat.appendable) , expected result type any error occurred in application involving default arguments. index.scala.html /play-scala-test-app/app/views line 3 java problem type html not member of package play.api.templates index.scala.html /play-scala-test-app/app/views line java problem i tried remove default imports , add new import play.twirl.api._ in play2 project properties, changed nothing. there way fix configuration? i don't know first issue, second 1 caused outdated sbte...

lua - attempt to index field '' (a nil value) -

i trying run script done sethbling, gives me error: luainterface.luascriptexception: dp1.state luainterface.luascriptexception: [string "main"]:337: attempt index field 'neurons' (a nil value) this the code a flamanis posted comment on youtube. followed instructions , got working. how work! takes place inside folder bizhawk emulator in. execpt part: before ever opening lua console on bizhawk, (if have, instructions on how reset stuff @ bottom) go onto level want have learn, , when level starts up, click on file. go down , open menu of save state, @ bottom click create named state, , name dp1, put after slashes , whatever delete gamestate.whatever jargon auto names it. after doing that, either move file snes/state folder have lua file, or other way around. , load lua file console, , boom you're good. if tried run lua file , errors: either need delete save, or edit lua file slightly. if want delete save appro...

unity3d - Template for component construction in Unity with C# -

programming in c# in unity requires tremendous amounts of boiler-plate. partly due c#, due design decisions in engine itself. the fact cannot construct monobehaviours myself means need write code following enforce correct initialization: using system; using system.collections.generic; using unityengine; public class myclass : monobehaviour { private int a; private float b; private string c; private list<int> lst; public static myclass construct (int a, float b, string c,list<int> lst) { //boiler-plate stuff var go = new gameobject (); var mc = go.addcomponent<myclass> (); /* * part fugly. static method setting * fields on object. responsibility * initialized after construction should * lie on object. * forget set fields * outside. */ mc.a = a; mc.b = b; mc.c = c; mc.lst = lst; return mc; } ...

.net - c# Windows Phone cannot find json file -

Image
i'm trying read data json file in .net 4.5 windows phone app. after pressing button exception appears saying: system.io.filenotfoundexception (exception hresult: 0x80070002) my code: public static async task readfile() { storagefolder local = windows.applicationmodel.package.current.installedlocation; if (local != null) { var file = await local.openstreamforreadasync("bazadanych.json"); using (streamreader streamreader = new streamreader(file)) { json = streamreader.readtoend(); } } } here's view of solution explorer: you're not copying file local storage. put json file under assets folder, make sure it's properties says "content" , "copy always" on first launch should read json package var filename = "assets/bazadanych.json"; var sfile = await storagefile.getfilefrompathasync(filename); var filestream = await sfile.openstreamforreadasync(); ...

javascript - Making Google maps marker array global breaks marker click event -

in page use following script: function initialize() { var mapcanvas = document.getelementbyid('map'); var mapoptions = {center:new google.maps.latlng(latitudemid,longitudemid),zoom:15,maptypeid:google.maps.maptypeid.roadmap,streetviewcontrol:false,maptypecontrol:true,scalecontrol:true,scalecontroloptions:{position:google.maps.controlposition.top_right}}; var map = new google.maps.map(mapcanvas, mapoptions); var markers=[]; //<=========================================== inside function initialize() var i; var insertion; var previousmarker; (i = 0; < fotocount; i++) { var mylatlng=new google.maps.latlng(latituden[i], longituden[i]); var marker = new styledmarker({styleicon:new styledicon(styledicontypes.marker,{color:'00ff00',text:letters[i]}),position:mylatlng,map:map}); marker.set('zindex', -i); marker.myindex = i; markers.push(marker); google.maps.event.addlistener(marker, 'click', function() { ...

objective c - How can I trigger an event only when the power button is pressed in iOS? -

i have app trigger when user presses power button several times. app works background process , listens cfnotificationcenterref triggered when display status changes. sensitive. when device receives kind of notification display automatically changes triggers event. there way detect power button presses? much of code borrowed detect screen on/off ios service i register observer background process cfnotificationcenteraddobserver(cfnotificationcentergetdarwinnotifycenter(), //center null, // observer displaystatuschanged, // callback cfstr("com.apple.iokit.hid.displaystatus"), // event name null, // object cfnotificationsuspensionbehaviordeliverimmediately); this code handles event. static void displaystatuschanged(cfnotificationcenterref center, void *observer, cfstringref name, cons...

ios - Cannot subscript a value of type [CLPlacemark] with an index type int -

i retrieve current location. work on swift xcode 7. looked plusieur tutorials, every time use same method. here code , error: ! error : cannot subscript value of type [clplacemark] index type int import uikit import corelocation class viewcontroller: uiviewcontroller, cllocationmanagerdelegate { let locationmanager = cllocationmanager() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.locationmanager.delegate = self self.locationmanager.desiredaccuracy = kcllocationaccuracybest self.locationmanager.requestwheninuseauthorization() self.locationmanager.startupdatinglocation() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func locationmanager(manager: cllocationmanager, didupdatelocations locations: [anyobject]) { clgeocoder().reversegeocodelocation(manager.location!, completionhandler: { (placema...

java - https proxy for GAE dev server -

i'm developing app gae. gae dev server doesn't support https, managed create https proxy using nginx. problem have third party service uses app, can make requests using https, i.e. can make request https://localhost , won't proceed http://localhost . inside app use library of service internally uses req.getrequesturl() httpservletrequest. so, request: request (to https: //localhost) -> nginx proxy -> request (to http: //localhost) -> dev gae server. , req.getrequesturl() returns "http: //localhost" doesn't match in request field (it's special field in request specified protocol of service) , library throws exception. can do? nginx config: server { listen 443 ssl; # ssl directive tells nginx decrypt # traffic server_name localhost; ssl_certificate ls.crt; # certificate file ssl_certificate_key ls.key; # private key file location / { proxy_pass http://lo...

android - Having problems to implement a setOnClickListener - Fragment -

i'm having problems implement onclick items have in list. error below: 06-14 16:15:43.861 11651-11651/wk.gon250.dublinbike e/androidruntime﹕ fatal exception: main process: wk.gon250.dublinbike, pid: 11651 java.lang.runtimeexception: don't call setonclicklistener adapterview. want setonitemclicklistener instead @ android.widget.adapterview.setonclicklistener(adapterview.java:778) @ tab.tab2.oncreateview(tab2.java:67) the code of class is: public class tab2 extends fragment { static listview listview; static customadapter adapter; @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view v = inflater.inflate(r.layout.tab_2, container, false); string url = "http://mypath"; requestqueue queue = volley.newrequestqueue(getactivity()); final progressdialog progressdialog = progressdialog.show(getactivity(), "please, wait"...

r - Convert a character variable into a logical expression in order to use it later inside the subset argument of the subset() function -

i'm trying convert character variable logical expression in order use later inside subset argument of subset() function, , of inside bigger function called early_prep() created. problem when execute early_prep(file_name = "n44.txt", keep_rows = "block > 1") it deletes rows in raw_data data frame instead of deleting in block > 1. any appreciated. best, ayala bellow relevant part of early_prep() function: early_prep <- function(file_name,keep_rows = false){ read_data <- function(file_name){ extension <- substr(file_name, nchar(file_name) - 3, nchar(file_name)) if (extension == ".txt"){ raw_data <<- read.table(file_name, header = true) # print console print("#### reading txt file ####", quote = false) } else if (extension == ".csv"){ raw_data <<- read.csv(file_name, header = true) # print console print("#### reading csv file ####", quote = false) ...

Wordpress: uploading images using php - can't create different image sizes -

i trying simulate wordpress default upload process. here go images: <input type="file" name="imgsupload1[]" id="imgsupload1[]" multiple=""> the code should upload: $post_imgs = $_files['imgsupload1']; foreach ($post_imgs['name'] $key => $value) { if ($post_imgs['name'][$key]) { $file = array( 'name' => $post_imgs['name'][$key], 'type' => $post_imgs['type'][$key], 'tmp_name' => $post_imgs['tmp_name'][$key], 'error' => $post_imgs['error'][$key], 'size' => $post_imgs['size'][$key] ); $img_caption = $img_captions[urlencode(basename($file['name']))]; $new_file = wp_handle_upload($file, array( 'test_form' => false )); $filename = $new_file['url']; $filetype = wp_check_filet...

php - Weird behaviour in SimpleXMLElement Object when printing the array -

i'm struggling array in simplexmlelement object . somehow don't expected result when print array $node->reference . print_r($node); shows: simplexmlelement object ( [reference] => array ( [0] => simplexmlelement object ( [@attributes] => array ( [resourceidentifier] => 52chgb7f-1a00-4eaf-ac8a-5d4557f9796a ) ) [1] => simplexmlelement object ( [@attributes] => array ( [resourceidentifier] => 52cbccc3-b754-4e88-9238-5d5257f9796a ) ) ) ) but print_r($node->reference); , print_r($node->reference->children()); shows: simplexmlelement object ( [@attributes] => array ( [resourceidentifier] => 52chgb7f-1a00-4eaf...