Posts

Showing posts from April, 2014

apache - how hide extension of my php files -

i`m trying hide php files extension in hosted server.i add following code segment in .htaccess file. rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.html -f rewriterule ^(.*)$ $1.html rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php but when try, not working. tried same thing in localhost.it not working properly. so have make other changes work on it? use rewriteengine on rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l]

python - Pygame, user input on a GUI? -

this question has answer here: how accept text input pygame gui 2 answers i need user input pygame program , need on gui(pygame.display.set_mode etc.) , not like: var = input("input something") . have suggestions how this? there answers here. anyway, use pgu (pygame gui utilities), it's available on pygame's site. turns pygame gui toolkit. there explanation on how combine , game. otherwise, program using key events. it's not hard time consuming , boring.

r - Error: package or namespace load failed for ggplot2 and for data.table -

i not able open install ggplot2 , data.table packages. gives me following error (example ggplot2) > library(ggplot2) error in loadnamespace(j <- i[[1l]], c(lib.loc, .libpaths()), versioncheck = vi[[j]]) : there no package called ‘rcpp’ error: package or namespace load failed ‘ggplot2’ i able work fine these 2 packages before closed r session. shows me error each time try run it. i have tried remove , re-install it, without success. remove.packages(c("ggplot2", "data.table")) install.packages('ggplot2', dep = true) install.packages('data.table', dep = true) i not sure what's wrong this solved issue: remove.packages(c("ggplot2", "data.table")) install.packages('rcpp', dependencies = true) install.packages('ggplot2', dependencies = true) install.packages('data.table', dependencies = true)

floor - How to round up in fraction part php -

i have value 2.3 , 3.6 , 3.8 want value closest fraction. suppose when value 2.3 modified value 2.5 when value 2.2 modified value 2 i understand want round closest "half integer". if so, can use round() function little modificators. because round() returns integers, need modify value before rounding , again after rounding in reverse way make work. since want round 0.5, 1/2, need first multiply value 2, , divide after. so pattern here is: $roundedval = round($origval*2)/2; and examples question: var_dump(round(2.3*2)/2); //2.5 var_dump(round(2.2*2)/2); //2.0

c++ - Scons: how to check file before compilation with commands which doesn't product any output file? -

i work project in every object files being built 3 times: with newest g++ lots of flags in order find every possible errors , warnings with clang in order above , check style. with g++ compatible 3rdpart libraries (no newer version, entire product based of libraries) works way: if object file should recompiled: steps 1, if success 2, if success 3 being done. done makefile, i'm planning use scons its. problem in current solution object file 1 , 2 being saved /dev/null. i've tried line this: 3 files in same directory: hello.cc, sconstruct, sconscript sconstruct #!python warningflags = ' -wall -wextra -werror' # , many more env = environment(cxx = 'g++-4.8', parse_flags = warningflags, cpppath = '.') builtobjects = env.sconscript('sconscript', variant_dir='built', duplicate=0, exports='env') env.program(target = 'hello', source = builtobjects) sconscript #!python import('env') builtobjects = ...

jquery - change input text field into label with input typed value inside label javascript -

i want change text field label tag input user typed text inside it. have tried , seen many example working not set value text in label. e.g.: <input id="1" type="text" value="hi"/> i want replace input text field label or div tag innerhtml hi or user typed value have tried example below not done me. <p id="1" onclick="wish(id)">sasdsad</p> <script> document.getelementbyid("1").outerhtml = document.getelementbyid("1").outerhtml.replace(/p/g,"div"); </scrip> element id should start character not number. with using jquery <input id="one" type="text" value="hi"/> $('#one').replacewith("<div>"+$('#one').val()+"</div>");

java - Spring Batch, variable through the steps of a job -

i'm trying create job in spring batch can't find something.. program looks : a tasklet wich create list of ids a reader use list string in database , concatenated them a writer take string , write in file a tasket use list of ids , update database. first, best choice structure of batch ? the main problem don't know how list of ids in reader , in last tasklet. i'm using spring , i've tried : <bean id="idlist" class="java.util.arraylist" scope="job" /> <bean id="myfirsttasklet" class="myfirsttasklet" <property name="idlist" ref="idlist" /> </bean> <bean id="myreader" class="myreader" <property name="idlist" ref="idlist" /> </bean> <bean id="mysecondtasklet" class="mysecondtasklet" <property name="idlist" ref="idlist...

algorithm - Java recursion provides two different results. Why? -

i have ambiguous understanding result of following code segment. please me understand example. this first code segment: public static void main(string args[]) { int number = 4; system.out.print(what(number)); } public static int what(int number){ if(number < 2) return 1; else return what(number-2) + what(number -1); } this returns 5 result. when trying run recursion method individually operand both code segments return 1 result. the following code returns 1 result: public static int what(int number){ if(number < 2) return 1; else return what(number-2); } and same holds code: public static int what(int number){ if(number < 2) return 1; else return what(number-1); } i need understand how works. the first method sums 1's, whereas latter method print result of what() , can nothing more or nothing less 1. example of first method: what(4) = what(2) + what(3) = wha...

Find adjacent entries for a javascript Map? -

given var mymap = new map() mymap.set("alpha", "first") mymap.set("beta", "second") mymap.set("charlie", "third") mymap.set("delta", "fourth") mymap.set("echo", "fifth") mymap.set("foxtrot", "sixth") starting given key... mymap.get("charlie") //=> "third" ... how values surrounding keys? // pseudo code mymap.get("charlie").prev() //=> "second" mymap.get("charlie").next() //=> "fourth" ideally, i'd while iterating on mymap : var valuesicareabout = []; mymap.foreach(function(value, key, map) { valuesicareabout.push({ callsign: key, callvalue: value, nextcallvalue: map.get(key).next(), // pseudo code prevcallvalue: map.get(key).prev() // pseudo code }); }); in actual use case, keys of map dom nodes, , need siblings in order calculate position offsets. expe...

jquery - Cannot get DataTable to load all data -

something seems wrong data, because i'm getting requested unknown parameter 2 row 0 when execute following: var items = $('#items').datatable({ dom: "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>", paginationtype: "full_numbers", language: { lengthmenu: "_menu_ items per page" }, processing: true, serverside: true, statesave: true, ajax: { url: "items/data", method: 'post' }, columndefs: [ { targets: ['th-image'], searchable: false, data: 'image_url', render: function (data, type, full) { return '<img src="' + data + '" alt="thumbnail" class="img-thumb...

java - BigDecimal initialized with integer literal with leading zeros -

this question has answer here: integer leading zeroes 8 answers kindly me in understanding following code, bigdecimal d = new bigdecimal(000100); system.out.println(d); // output 64!!!! bigdecimal x = new bigdecimal(000100.0); system.out.println(x); // output 100 shouldn't use bigdecimal process int or long value in scenario? (i mean leave performance , stuff, know not advisable use bigdecimal process int or long). data has mix of both long , decimal values, trying know bigdecimal. the problem not bigdecimal literal numbers you're passing in. when int literal starts 0 , java interprets octal number . an octal numeral consists of ascii digit 0 followed 1 or more of ascii digits 0 through 7 interspersed underscores, , can represent positive, zero, or negative integer. that why 000100 produces 64 -- 100 8 64 in decima...

python - Bokeh DeprecationWarning: Setting a fixed font size value as a string 'text_font_size' is deprecated -

/library/python/2.7/site-packages/bokeh/properties.py:363: deprecationwarning: setting fixed font size value string 'text_font_size' deprecated, set value('text_font_size') or ['text_font_size'] instead super(hasprops, self). setattr (name, value) i getting warning when running code: myfig.text(x=[i], y=[.5], text=["abc"], text_align='center', text_font_size=['10pt'], text_color='#cdefcc') can ? how rid of ? it looks active bug bokeh. there github issue it . here snippet of response: hi @marcomayer looks found little bug. "list" syntax may go away anyway. can set values this, however: from bokeh.properties import value p.axis.major_label_text_font_size=value("8pt") for little context, reason deprecation string values data specs are, in every other context, interpreted column data source column names. changes brings consistency interface.

javascript - Can XPath be used to search a <script> block? -

i'm ok skills-wise @ selecting sorts of html content. confident creating code should ripping content of site stumbled across strange javascript code source puts prices in. <script> var productconfig = {"attributes":{"178":{"id":"178","code":"bp_flavour","label":"smaak","options":[{"id":"28","label":"aardbeien","oldprice":"0","products":["2292","2294","2296","2702"]} .... more gibberish , 4 of each product variation: (so 80 different lines this:) ,"childproducts":{ "2292":"price":"64.99","finalprice":"64.99","no_of_servings":"166","178":"27","179":"34"}, "2292":"price":"17.99","finalprice":"17.99",...

Generating an Asset-folder in pimcore -

i can generate object-folder in pimcore via pimcore\model\object\folder::create() . unfortunately there no such function in asset\folder . has idea how generate asset-folder without hacking db? take how admin ui in: /pimcore/modules/admin/controllers/assetcontroller.php / addfolderaction() line 331: $asset = asset::create($this->getparam("parentid"), array( "filename" => $this->getparam("name"), "type" => "folder", "userowner" => $this->user->getid(), "usermodification" => $this->user->getid() ));

python - TypeError: argument of type 'method' is not iterable -

error traceback (most recent call last): file "c:/users/rcs/desktop/project/shm.py", line 435, in <module> app = shm() file "c:/users/rcs/desktop/project/shm.py", line 34, in __init__ frame = f(container, self) file "c:/users/rcs/desktop/project/shm.py", line 384, in __init__ if "3202" in q: typeerror: argument of type 'method' not iterable code some part of code, initialisation , all while 1: q = variable1.get if "3202" in q: variable2.set("ni node3202") try: switch(labelframe2, labelframe1) except: switch(labelframe3, labelframe1) elif "3212" in q: variable2.set("ni node3212") try: switch(labelframe1, labelframe2) except: switch(labelframe3, labelframe2) elif "3214" in q: variable2.set("ni node3214") try: ...

angularjs - Update model outside of controller -

just starting out on angular, not sure how update model out of controller, or in fact if have head around do. have autocomplete field based on ion.autocomplete html <span ng-controller="ionautocompletecontroller"> <label class="item item-input item-stacked-label"> <span class="input-label">item description</span> <ion-autocomplete ng-model="model" item-value-key="name" item-view-value-key="view" items-method="gettestitems(query)" multiple-select="false" placeholder="bread, milk, eggs etc .." items-clicked-method="itemsclicked(callback)"/> </span> <button class="button button-block button-royal" ng-click=...

android - onKey event for editText not firing -

i'm having hard time getting onkey event trigger on edittext view. i've been googling on hour , seems says have add onkeylistener view it's not triggering it. tried adding entire activity , tried adding view neither way triggering function. my code: xml: <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/interests_edittext" /> java: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.add_post); interests_edittext = (edittext) findviewbyid(r.id.interests_edittext); interests_edittext.setonkeylistener(new onkeylistener(){ public boolean onkey( view view, int keycode, keyevent event){ log.i("debug","test"); if (keycode == keyevent.keycode_enter) { return true; ...

sql - IBM DB2 // Create Alias in Stored Procedure -

i using latest edition of ibm´s db2 express-c. in 1 of stored procedures trying add create alias - statement existing table. "unexpected token" error message after executing create statement stored procedure. so question: read documentation create alias . there no limitation special context. implment create alias in stored procedure successfuly? this snipped dbproc: declare sql varchar(450); set t1 = 'm2f.m2f_k' || i_tablenr; set t2 = 'm2f.m2f_k' || i_tablenr || '_zuodoc z' ; -- create alias m2f.kxx t1; create alias m2f.kxx m2f.m2f_k11; for_loop: rs c1 cursor thank you! oliver most ddl statements, including create alias , must executed dynamically in stored procedures: execute immediate 'create alias m2f.kxx ' || t1; here's link manuals for latest version of db2 luw.

ios - UIBezierPath & CAShapeLayer initial animation jump -

Image
i built company: https://github.com/busycm/bzystroketimer , during course of building, noticed interesting "bug" can't seem mitigate when using uibezierpath . right when animation starts, path jumps number of pixels forward (or backwards depending if it's counterclockwise) instead of starting smooth, incremental animation. , found that's interesting how path jumps forward value of line width cashaperlayer . so example, if bezier path starts off @ cgrectgetmidx(self.bounds) , line 35, animation starts cgrectgetmidx(self.bounds)+35 , larger line width, more noticeable jump is. there way rid of path smoothly animate out start point? here's picture of first frame. looks after animation starts. then when resume animation , pause again, distance moved 1/100th of distance see in picture. here's bezier path code: - (uibezierpath *)generatepathwithxinset:(cgfloat)dx withyinset:(cgfloat)dy clockwise:(bool)clockwise{ uibezierpath *path = [uibezie...

java - JAXB transformation not working in Mule -

Image
i following mule tutorials perform jaxb transformations. exception trace below, followed configuration i using mule 3.6.2 ee on jdk 1.7 warn 2015-07-18 12:41:34,326 [main] org.mule.config.spring.muleartifactcontext: exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.beancreationexception: error creating bean name '_mulenotificationmanager': factorybean threw exception on object creation; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'jaxb_context': invocation of init method failed; nested exception javax.xml.bind.jaxbexception: provider com.sun.xml.bind.v2.contextfactory not instantiated: javax.xml.bind.jaxbexception: "com.mulesoft.training" doesnt contain objectfactory.class or jaxb.index - linked exception: [javax.xml.bind.jaxbexception: "com.mulesoft.training" doesnt contain objectfactory.class or jaxb.index] @ org.spr...

ios - Vote feature implementation -

hello error saying could not find overload != accepts supplied documents , don't know change. stuck long time. trying implement vote feature in collection view. if user taps button adds 1 vote parse , shows on label. method wrong? below code collection view cell highlighted code error is. import uikit import parseui import parse var votes = [pfobject]() class newcollectionviewcell: uicollectionviewcell { var parseobject = pfobject(classname: "posts") @iboutlet weak var postsimageview: pfimageview! @iboutlet weak var postslabel: uilabel! @iboutlet weak var voteslabel:uilabel? override func awakefromnib() { super.awakefromnib() // initialization code postslabel.textalignment = nstextalignment.center print("passing11") } @ibaction func vote(sender: anyobject) { if (parseobject != nil) { if let votes = parseobject!.objectforkey("votes") as...

python - How to find a particular string within another string as quickly as possible? -

i'd know if there better/nicer/faster way solve following problem. return true if given string contains appearance of "abc" abc not directly preceded period (.). "qabc" counts "r.abc" not count. my solution was: def abc_there(string): tmp = 0 in xrange(len(string)): if string[i:i+3] == "abc" , string[i-1] != ".": tmp += 1 return tmp > 0 edit: just clarify: ".abc" --> false ".abcabc" --> true only instance next right of period gets erased. there less straight-forward way problem , it's faster too. code: def xyz_there(string): return string.count(".abc") != string.count("abc") this works because if there string passed "abc.abc", ".abc" count 1 abc count 2 if string "fd.abc.abc" example. return false. to prove it's faster, headed on ipython. in [1]: def abc_there(string): ....

ios - SpriteKit Game slows down -

i writing ios app. has tab bar controller , 1 of tab displays view has collection view - lists different mini games. when tap on particular item, show view consists of both uiview , skview. skview presents skscene of game play happens. there close button closes view , user collection view. now works fine first few iterations - tap on item in collection view, shows game , can play without hassle , close it. animations smooth. if keep opening , closing view, becomes sluggish , animations slower , slower. makes other parts of app sluggish. clearing skscene, deleting children, removing actions. instruments don't show retail or memory leaks. not sure whats going wrong. please help! okay, answering own question. never ever use nstimer in spritekit. problem in case. replacing update method fixed things me.

web services - Scheduled tasks for REST request in WSO2 ESB -

i'd schedule tasks in wso2 esb in order use restful web services , obtain, these web services, responses every n seconds. in task configuration page in wso2 esb configuring soap services simple, rest services? example, if want ask information web service http://maps.googleapis.com/maps , how can configure working task? from task, can inject messages restful endpoints through sequence or proxy service. refer injecting messages restful endpoints section of [1] more details on how this. [1] https://docs.wso2.com/display/esb481/adding+and+scheduling+tasks

nReco.Video Converter ffMpeg Error -

i using nreco video converter take video thumbnail on mvc project. app working correctly on local shows error on live host error is access path 'c:\inetpub\vhosts********\httpdocs\bin\ffmpeg.exe' denied. i did search file in code , host bin folder can't found. nreco's site says simple , easy use video conversion .net library: need 1 assembly (ffmpeg embedded) there no ffmpeg.exe file in local , host bin folder or anywhere. how can fix this? thanks. videoconverter .net wrapper ffmpeg tool (i'm author of library) , ffmpeg.exe extracted app bin folder (default location) on first use. on live host asp.net process cannot write app bin folder; may fixed specifying location, example: var ffmpeg = new ffmpegconverter(); ffmpeg.ffmpegtoolpath = system.web.httpcontext.current.server.mappath("~/app_data");

vb.net - Binding datagridview font color in datatable c# -

so right have set datatable , binded datagridview. what program saves realtime log datatable. need have font color in each row based on log level save font color @ each row in data table (6th array of datatable) is there solution bind style datatable , datagridview? i using filter search need able backup color once had before color implented. currently doing. biggest problem after filter has been implemented, style property gone , becomes again no colored colum (all black again) if (value.contains("<notice>:")) { datagridview1.rows[rownumber].defaultcellstyle.forecolor = color.forestgreen; logparserview.rows[rownumber][6] = "forestgreen"; } else if (value.contains("<debug>:")) { datagridview1.rows[rownumber].defaultcellstyle.forecolor = color.orange; logparserview.rows[rownumber][6] = ...

android - Google Play Game Services Snapshot bitmap size -

i have created game android uses google play game services. 1 of things use save games or snapshot functionality. to create new snapshot use code below. snapshotmetadatachange metadatachange = new snapshotmetadatachange.builder() .setdescription(description) .setprogressvalue(savegame.getprogressinlevel()) .setcoverimage(savegame.coverimage) .build(); games.snapshots.commitandclose(gamehelper.getapiclient(), savegameresult.snapshot, metadatachange); one of thinks save in snapshot cover image. now i'm seeing problem reports outofmemoryerror's. causing cover image big. so, question here is: requirements of bitmap? how big can be? resolution can have? , aspect ration best? i unable find answers on in documentation google. "google play games services enforce size limits on binary data , cover image sizes of 3 mb , 800 kb respectively." this information can found in link . i ...

java - Extract any value from hashmap (one for each key) -

i have large map different keys , several values (depthfeed) associated each. value (depthfeed) able extract name of instrument 1 each key. i have map private static map<integer, list<depthfeed>> mapdepthfeed = new hashmap<>(); from like, not returning keyset integer. instead want list<depthfeed> (containing 1 row each key) list<depthfeed> d = mappricefeed.values().stream().distinct().collect(collectors.tolist()); use list<depthfeed> result = mapdepthfeed.values().stream() .filter(list -> !list.isempty()) .map(list -> list.get(0)) .collect(collectors.tolist()); this way first element each non-empty list stored in map values.

ordinal - How do I find the difference in levels between two vectors of ordered factors in R? -

let's have 2 ordered factors start , end same length , use same levels. how return vector shows me how many levels each element has changed start end ? so example let's have: start = 'c5', na, 'c3', 'c5', 't1' end = 'c5', 'c5', na , 'c6', 'c6' levels: c2 < c3 < c4 < c5 < c6 < c7 < c8 < t1 < t2 < t3 < t4 < t5 < t6 < t7 < t8 < t9 < t10 < t11 < t12 < s1 < s2 < s3 < s45 what ideally want simple end - start give me c(0, na, na, 1, -3) here's code setting above example lvls<-c("c2","c3","c4","c5","c6","c7","c8", "t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12", "s1","s2","s3...

ios - How to make sure the generated random number is not equal to the next generated number? -

i generating random number (only 0-2) in swift each time button pressed. don't want generate same number twice in row. did it's not working. var currentnumber:int = 5 var randomnumber:int = 0 { randomnumber = int(arc4random_uniform(uint32(3))) } while randomnumber == currentnumber currentnumber = randomnumber you need make randomnumber property of viewcontroller remembered between button presses. each time, there 2 valid random numbers, generate number in range 0 1 , change 2 if matches previous number: class viewcontroller: uiviewcontroller { // give randomnumber initial value var randomnumber = int(arc4random_uniform(uint32(3))) @ibaction func buttonpressed(button: uibutton) { let currentnumber = randomnumber randomnumber = int(arc4random_uniform(uint32(2))) if currentnumber == randomnumber { randomnumber = 2 } } } this has advantage of needing 1 random number each button press.

Capture exit status from function in shell script -

i have simple script. test.sh _execute_method () { exit 1 } _execute_method error_code=$? if [[ $error_code -eq 1 ]]; echo "got error" exit 0 fi this script terminate when exit 1 executed inside function. want capture exit status function , handle in main script. i have tried set -e & set +e , still no success. can not use return statement. actual output: $ sh test.sh $ echo $? 1 $ actual output: $ sh test.sh got error $ echo $? 0 $ you need use return instead of exit inside function: _execute_method () { return 1; } _execute_method error_code=$? if [[ $error_code -eq 1 ]]; echo "got error"; fi exit terminate current shell. if have use exit put function in script or sub shell this: declare -fx _execute_method _execute_method () { exit 1; } ( _execute_method; ) error_code=$? if [[ $error_code -eq 1 ]]; echo "got error"; fi (..) execute function in sub-shell hence exit terminate sub-shell.

imagemagick - Converting jpg image with white background to transparent background png when image object also has white color -

Image
i trying convert few jpg files white background png transparent background. using following command: convert 2868cif.jpg -fuzz 10% -transparent white 2868cif.png the command works fine on of images. images white content converts them white. refer sample images below: original image convert image in logical terms, can understand why happening. wanted know if there workaround using imagemagick? try floodfill transparent color: convert input.jpg -fuzz 15% -fill none -draw "matte 0,0 floodfill" output.png

android: Can method Split return a null value? -

i problem when reading code. why coder determine allprovinces = null ? if(!textutils.isempty(response)){ string [] allprovinces = response.split(","); /* how should check whether allprovinces null or not? * means method "split" can possibly return null value? */ if( allprovinces != null && allprovinces.length > 0){ for(string p :allprovinces) { string [] array = p.split("//|"); province province = new province(); province.setprovincename(array [0]); province.setprovincecode(array[1]); weatherdb.saveprovince(province); } } } can method split return null value? split function return string[] containing @ least 1 element. you array of size 1 holding original value: split method character "-" input output ----- ------ abcd-xyz {"abcd", "xyz"} qwert {...

javascript - pass custom parameters to ajax request and get back the same in response -

i make series of asynchronous ajax calls , response dumped textfile. if want identify responses got ajax calls in file, don't have unique identifier. there way send custom parameter in ajax call , same on response call made unique ajax request? $.ajax({ type: "post", url: posturl, // location of service data: postdata, //data sent server contenttype: "application/json", // content type sent server crossdomain: true, async: true, password : attr, success: function(data,success) { } }); so, using code snippet above, without moving it's own function, can this ... ... inputidentifer = 'this sort of identifying value'; (function(identifier) { $.ajax({ type: "post", url: posturl, // location of service data: postdata, //data sent server contenttype: "application/json", // content type sent server crossdomain: true, as...

comments - How to create a dicussion forum on android application? -

i thinking of developing public discussion forum. the idea people can register , login in. the forum contain posts on different subjects, , users can comment, like/dislike. similar facebook idea of likes , comments. can me this?

File upload with intermittent connection in node.js -

i want upload file intermittent connection using node.js can please me how it. flow.js file upload library can handle restarts intermittent connection. give try!

php - FacebookSDK search by username/pagename -

i'm trying access public information user based on username/pagename. i'm doing this: $uname = 'csga5000'; $session = new facebook\facebook([ 'app_id' => self::$facebook_app_id, 'app_secret' => self::$facebook_app_secret, 'default_graph_version' => 'v2.2' ]); try { // returns `facebook\facebookresponse` object $response = $session->get('/search?q='+$uname+'&type=user'); } catch(facebook\exceptions\facebookresponseexception $e) { print_r($e); echo 'graph returned error: ' . $e->getmessage(); exit; } catch(facebook\exceptions\facebooksdkexception $e) { echo 'facebook sdk returned error: ' . $e->getmessage(); exit; } but exception thrown, here output: graph returned error: (#803) of aliases requested not exist: v2.20 alternatively(got looking @ source code) $response = $session->sendrequest('get','/search',['...

mysql - Combine two similar rows into one with new columns -

original table: name age contact_type contact alex 20 sms 12345 alex 20 email abc@gmail.com alex 20 sms 54321 bob 35 sms 23456 i want make as: name age contact_type1 contact_1 contact_type2 contact_2 contact_type3 contact_3 alex 20 sms 12345 email abc@gmail.com sms 23456 bob 35 sms 23456 if name , age duplicated, combine 2(or more) rows 1 row new column shown above. i want finding same 'name' , 'age', , using distinct contact case when count distinct(contact)>0 seems many syntax error occur. there smarter method make it? use conditional aggregate this select name,age, max(case when contact = 'sms' contact end) contact_1, max(case when contact = 'email' contact end) contact_2 yourtable group nam...

wamp - Apache: You don't have permission to access / on this server -

just installed wamp on windows 7 machine. when go localhost / localhost, works. when try go machine computer on local network, following error message: forbidden you don't have permission access / on server. apache/2.4.9 (win64) php/5.5.12 server @ 192.168.1.13 port 80 how solve this? see below question. have allow access through port 80 apache server in httpd.conf making sure have listen *:80 how access site running apache server on lan without internet connection an additional resource items when install fresh copy of wamp http://forum.wampserver.com/read.php?2,119754,119754

How can I create dependent category and subcategory drop down menus? -

how can create dependent drop-down menus category , subcategory, subcategory's options dependent upon selected in category menu? creating e-commerce store. on admin side have user enter products. using form includes select options "category" , "subcategory", can't find tutorials or forums address specifically.

device - Android : Google sign in api returning Null -

i followed tutorial on how use google sign in in app , working fine in emulator. when created signed apk release type , send sister via email check if able login, after selecting user account login not able login. google api returns null during login process. private void showsignedinui() { // todo: start making api requests. try { if (plus.peopleapi.getcurrentperson(mgoogleapiclient) != null) { person currentperson = plus.peopleapi .getcurrentperson(mgoogleapiclient); string personname = currentperson.getdisplayname(); string personphotourl = currentperson.getimage().geturl(); string persongoogleplusprofile = currentperson.geturl(); string emailuser = plus.accountapi.getaccountname(mgoogleapiclient); log.e(tag, "name: " + personname + ", plusprofile: " + persongoogleplusprofile + ", email: " + emailuser ...

c# - Two side button display on a table -

Image
i want automatically switch on / off electric appliances. want add 2 side button in tableview . how can this? you override how button drawn along boolean value hold on/off state of control. quick ugly attempt cleaned little work is: class onoffbutton : button { bool on = true; protected override void onpaint(painteventargs pevent) { pevent.graphics.clear(this.backcolor); pevent.graphics.drawrectangle(pens.blue, 0, 0, 85, 25); if (on) { pevent.graphics.drawstring("on", new font("microsoft sans serif", 8, fontstyle.bold), brushes.black, 5, 5); pevent.graphics.fillrectangle(brushes.gray, 50, 1, 35, 24); } else { pevent.graphics.drawstring("off", new font("microsoft sans serif", 8, fontstyle.bold), brushes.black, 50, 5); pevent.graphics.fillrectangle(brushes.gray, 1, 1, 35, 24); } } protected override ...

javascript - copy input from one table to another table on same document -

please want use javascript copy input 1 table table on same document. there 2 tables. in first table, user input desired value. these values used column headers in 2nd table. far not getting script. please experts know doing wrong. <!doctype html> <html> <head> <title>prtqual</title> <style type="text/css"> body {font-family: arial, verdana, helvetica,sans-serif; padding: 0px; margin-left: 0px; margin-left: 50px; max-width: 800px;} p, table {margin-left: 25px;} th {font-weight: bold; font-size: 14px; border: 1px; border-style: solid; margin: 0px; border-colapse: colapse; border-spacing: 0px;} td {font-weight: normal; font-size: 14px; border: 1px; border-style: solid; margin: 0px; border-colapse: colapse; border-spacing: 0px;} .hide {display: none;} .show {display: display;} .hove: hover {background-color: rgb(250,250,150);} .btn {padding: 5px 5px 5px 5px; background-color: rgb(240,240,240); margin- left: 25px; text-align: center...

sql - MySQL DELETE FROM AS -

i trying delete kind of duplicates table can selected query: select * `articles` t1 exists ( select `id` articles t2 t2.link = t1.link , t2.id > t1.id ); so tried 2 queries don't seem work: delete `articles` t1 exists ( select `id` articles t2 t2.link = t1.link , t2.id > t1.id ); & delete t1 using `articles` t1 exists ( select `id` `articles` t2 t2.link = t1.link , t2.id > t1.id ); both return syntax error. you use multiple tables in from clause: delete t1 `articles` t1 , `articles` t2 t2.link = t1.link , t2.id > t1.id

r - Division of rows based on date in long format -

i have dataframe: df1 <- data.frame(datum = as.date(c("2015-01-01","2015-02-02","2015-03-03","2015-04-04","2015-05-05", "2015-02-02","2015-04-04","2015-01-01","2015-03-03","2015-05-05")), par = c(rep("n",5),rep("p",5)), val = 10:1) datum par val 1 2015-01-01 n 10 2 2015-02-02 n 9 3 2015-03-03 n 8 4 2015-04-04 n 7 5 2015-05-05 n 6 6 2015-02-02 p 5 7 2015-04-04 p 4 8 2015-01-01 p 3 9 2015-03-03 p 2 10 2015-05-05 p 1 i want division of rows par = n rows par = p on same date, , add dataframe. expected result should be: datum par val 1 2015-01-01 n 10.000000 2 2015-02-02 n 9.000000 3 2015-03-03 n 8.000000 4 2015-04-04 n 7.000000 5 2015-05-05 n 6.000000 6 2015-02-02 p 5.000000 7 2015-04-04 p 4.000000 8 2015-01...

php - How to put onclick event on a button whose values is coming from database -

i want add click event of change color when clicked on label values of label comes database. how may same? <legend>roti</legend> <?php $qu = mysql_query("select * submenu menu_id=33") or die(mysql_error()); while($f = mysql_fetch_array($qu)){ ?> <p> <label for="name"><?php echo $f['submenu']; ?></label> <input type="hidden" name="name" id="name" value="<?php echo $f['id']; ?>"> </p> <?php } ?> use onclick , give function name(here use changecolor() function name) shown below <label for="name" onclick="changecolor(this)"><?php echo $f['submenu']; ?></label> <!-- #### replace label code inside while loop --> <script> //########### add outside while loop...usually above closing body tag </body> function changecolor(obj){ obj.s...

.net dbnull.value sqlparameter where -

i have probleme sql query : i : select * mytable [myboolfield] null if run query, have results, but use parameters, add : select * mytable [mybitfield] @mybitfield with new sqlparameter("@mybitfield", dbnull.value) i have error @ @myboolfield if pass value true or false, that's work ( " = @mybitfield") can me ? thanks you can test null using is null . cannot use parameters , there wouldn't point. dbnull.value can used when inserting or comparing values in code, not on where conditions since null not equal null.

javascript - using ng-show on option select angularjs -

i want bind input field select option. if select option yes, input field should visible , if no, input field should hidden. (function(){ var app = angular.module('spa',[ $rootscope.options = [ { id: 0, name: 'no' }, { id: 1, name: 'yes' } ] ]); }()); <form name="newdata" class="ng-scope ng-pristine ng-invalid ng-invalid-required" error-popup="newdata" novalidate> <div class="form-group item item-input item-select"> <div class="input-label"> booking fee paid </div> <select name="booking" ng-model="user.booking" class="form-control ng-pristine ng-invalid ng-invalid-required" ng-options="option.name option in options track option.id" ng-init ="user.booking = options[0]" required> </select> </div> ...

regex - Automatically find short regexp to match a set of words? -

i not looking specific regular expression, software find them. let have file , file b: how find regexp matches words of a, not match of words in a? if contains "truit fruit" , b contains "ridiculous", software return ". ru. " '. r. ' invalid. it "practical" aspect of question [1], though interests me find actual software solves in practice. thanks help, nathann [1] https://cstheory.stackexchange.com/questions/1854/is-finding-the-minimum-regular-expression-an-np-complete-problem there no algorithm somehow "cleverly derive" regular expression examples. can implement brute force attempt of iteration through permutations of common substrings of words in , tests b against until find solution. not guaranteed find solution, though. for case there no common substrings of words in extend approach introduce "or" operator in regular expressions. get's ugly , slow. if not lead solution, you'd ...

haskell - Re-export qualified - how to solve it nowadays, any solution? -

this question has answer here: re-export qualified? 2 answers i have same issue described in question re-export qualified? module foo.a foo = 42 and module foo.b foo = 12 and want write super module module foo ( module foo.a , module foo.b ) import foo.a import foo.b which re-exports modules, name clash. it asked 5 years ago, suppose there might have been changes since then. have there been any? if not, there's still no solution that? i not consider lens resolving it. update : there can plenty of functions foo in each module (foo1, foo2, etc) , want use them both modules. there can data s same member names in each module, after all. so hiding isn't solution. there no new solution, there still solution. first you, 1 foo can exported have decide 1 want export bare foo . need hide , alias other on...

batch file - activate task view programmatically windows 10 -

is there way activate task view programmatically in windows 10? there way activate flip3d programmatically in win7 using following copied vbscript sendkeys ctrl+lwin+tab? createobject("wscript.shell").run "rundll32 dwmapi #105" i want make .vbs or .bat file activates windows 10 task view. ok found way c# install visual studio install nuget http://docs.nuget.org/consume/installing-nuget file > new project name taskview visual c# > console application file > save all tools > nuget package manager > package manager console type "install-package inputsimulator" in package manager console window paste following text in taskview.cs window using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using windowsinput.native;// importante namespace taskview { class program { static void main(string[] args) { windowsinput.input...

php - Verifying MD5 passwords using password_verify() -

is there way convert md5 password can verified password_verify() ? i read on crypt wikipedia page "the printable form of md5 password hashes starts $1$ ." hence give shot (without luck): $password = "abcd1234"; $md5hash = "$1$".md5($password); var_dump(password_verify($password, $md5hash)); is there way make password_verify() work md5 passwords? reason question: have old system passwords stored md5 hashes. want start using more secure password hashing api . if i'm able convert existing password hashes works password_verify() , can update database entries (prepend $1$ password hashes), , program work beautifully using following code (i don't have make special case old md5 passwords): $password; // provided user when trying log in $hash; // loaded database based on username provided user if(password_verify($password, $hash)) { // following lines both update md5 passwords // , passwords whenever default hashing algorithm ...

colors - Android textview outline text -

is there simple way have text able have black outline? have textviews different colors, of colors don't show on background well, wondering if there's easy way black outline or else job? i'd prefer not have create custom view , make canvas , such. you can put shadow behind text, can readability. try experimenting 50% translucent black shadows on green text. details on how on here: android - shadow on text? to add stroke around text, need bit more involved, this: how draw text border on mapview in android?

javascript - Call a js file from a plugin directory -

i creating wp plugin. in plugin folder have js folder contains small js file named call.js. plugin have functions.php file. now, getting issues (like js content being visible on front end) outing js. in plugin functions.php have following function basic_script() { wp_register_script( 'custom-script', plugins_url( '/js/call.js', __file__ )); wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'basic_script'); the plugin file looks correct require plugin_dir_path( __file__ ) . 'js/call.js'; i added following js in js file (function($) { $(document).ready(function() { var newval = $('#div2'); $('#div1').html( newval ); }); })(jquery) i understand making error somewhere unable find this. thanks in advance. try this $(document).ready(function() { var newval = $('#div2'); $('#div1').html( newval ); }); remove function code

javascript - Why there's a total index number of arrays in concat result -

var = ['a', 'b', 'c']; var b = ['d', 'e', 'f']; var c = ['g', 'h', 'i']; var d = [a, b, c]; (e in d) var f = d.concat(e); console.log(f); //[array[3], array[3], array[3], "2"] why there's 2 in there? how remove 2 , before result come out? (not alter result) "2" length property of resulting array. included, because loop using for ... in . if use for (var i=0; i<d.length; i++) {...} , not included. see snippet. anyway, seems me simplify whole enchillada using var f = d.slice() . citing mdn : array indexes enumerable properties integer names , otherwise identical general object properties. there no guarantee for...in return indexes in particular order , return enumerable properties, including non–integer names , inherited. because order of iteration implementation-dependent, iterating on array may not visit elements in consistent order. therefore better use loop...

android - Facebook - LoginFragment on a SingleInstance activity -

i using facebook sdk (4.3.0) loginbutton on fragment, hosted in activity launchmode set singleinstance, facebook login button seem have problem that, when pressed login action gets canceled right away messege : cannot call loginfragment null calling package. can occur if launchmode of caller singleinstance. an odd thing note doesnt heppen on devices, on samsung devices sony xperia doesnt suffer that, anyway, when remove single instance launch mode works fine, activity can have multiple instances brings weird user experience app users. how fix issue?

java - does control come back to the webapp which forwarded request to another webapp? -

i have 2 web apps. a.war b.war both have been deployed in same app server. request comes a.war , forwards request b.war via context.getservletcontext("appname of b").getrequestdispatcher("uri").forward(request, response); once request forwarded a b , once processing completed on b , control come web app a or web app b directly sends request client (browser)? in other words , separate thread executed in web app b in case , sends response directly user? as forward word says when user's request forwarded webapp/servlet , element invoked forward method no longer works , thread killed. in both situations, forwarding servlet or webapp creates new thread handle request. to move control first servlet/application should forward request again.

excel - Move the last 4 non-blank cells from a number of rows -

Image
i have done bit of digging had no luck, i'm looking move last 4 non-blank cells range of specific row align them. 2a 29h 0 0 0 0 24h 88h 13 7 4 0 35h 44h 71h 7 3 7 1 3a 62h 72a 8 3 8 4 17a 13 3 16 6 61a 67h 75a 10 2 8 3 25h 49h 16 3 5 1 36h 39a 51h 56h 78a 82h 16 6 8 3 20h 29h 45h 48h 79h 82h 90h 22 10 3 1 20a 28a 44h 46a 62h 69h 75h 84h 16 7 7 3 here list starting column e1 in top left corner, think of formula this? so need move numeric characters away values number , character. if didn't mind being in separate sheet, try =if(column()<column($aa$1), if(istext(sheet1!a1),sheet1!a1,""), index(sheet1!$a1:$z1,match(true,index...