Posts

Showing posts from February, 2013

Php function to format, prettify css -

is there php functions know of prettify/format inline css on fly? i have php functions opposite , minify css, js, html https://gist.github.com/tovic/d7b310dea3b33e4732c0 i'm looking opposite @ least, css, js too. i'm using minify function in theme i'm building, want offer developers option load non-minified styles , scripts testing , developing. works me loading .css files instead of .min.css files. but, of inline styles doesn't work. inline (echo) styles prettified well, when developers choose load prettified files. great! do know of any? thanks.

vim(spf13) config for racket programming language -

i use spf13 vim config 2 servers a , b . there problem in server b , vim doesn't have colour keyword when vim .rkt file. example file name temp.rkt : (define file "hey, i'am rkt file") the keyword define should colourful it's not in server b . both server a , b use spf13 config of vim. racket config works server a not work server b . why happen? how write config file vim can colour keyword racket programming language? (also, can use vim ask questions in stack overflow? thanks.)

html - Padding not working for divs icons -

i trying add padding .sloticon class. .slots class container, witch inline-block div, trying make both divs side side (50% width). this under "work" section. now padding doesn't affect icons, , margins move entire .slots div. all want lower icon , text, in .slots div. https://jsfiddle.net/js1rgh4b/1/ <div class="work" > <h2>work</h2> <div class="slots"> <div class="sloticon"></div> <p>slots</p> </div><div class="oea"> <div class="oeaicon"></div> <p>oea</p> </div> </div> css: .slots { display: inline-block; width: 50%; height: 350px; background-color: #3484ce; } .oea { display: inline-block; width: 50%; height: 350px; background-color: green; } .sloticon { width: 150px; height: 159px; background-repeat: no-repeat; background-image: url(http://medi...

r - Count function error (wrong result size) -

i having weird problem using count function introduced today. when type: a <- count(data, c("col1", "col2") error popping up error: wrong result size earlier code working fine. appreciated. e.g data <- matrix((1,2,1,2,1,3,1,3,2,3,2,4,2,3,2,5), nrow=8, ncol=2) most default dplyr functions made use data.frame column names unquoted ( non-standard evaluation ). hadley builds in standard eval versions, well, have same name, underscore ( _ ) @ end: in case, count_() . standard eval ones can use quoted values arranged yours above: count_(mtcars, c('cyl', 'gear')) really, standard-eval versions overkill unless need pass variable stores name, though. in case, normal non-standard eval version work neatly, , produce same thing, while saving typing few quotes: count(mtcars, cyl, gear) either way, get source: local data frame [8 x 3] groups: cyl [?] cyl gear n (dbl) (dbl) (int) 1 4 3 1 2 4 ...

ruby - Add a sidekiq monitor page into rails admin -

Image
how add sidekiq monitor page rails admin? i have tried use custom action don't know how use mount method in rails admin. does have solution? all need have sidekiq_monitor gem in gemfile . like this: sidekiq (3.5.1) sidekiq-failures (0.4.5) sidekiq-lock (0.3.0) sidekiq_monitor (0.1.7) rails_admin (0.7.0) offourse follow setup of sidekiq_monitor , , find link 'jobs' on left menu panel in rails admin. and links looks like: /admin/sidekiq~monitor~job

Cannot display portrait images captured by camera in android volley network image. -

i having recyclerview displaying series of images fetched server via json, similar instagram, issue landscape images displaying when user uploads portrait image not getting displayed in recyclerview there no error in code shown in logcat

ios - load rtf file into UITextView in Swift 2 -

can me load rtf text uitextview swift 2? answers i've gotten old , out of date. text instructions on how play game i'm writing in app. far, i've been able copy , paste rtf text placeholder box. works iphones in simulator, when trying in ipad simulator or iphone 6 plus there appears double vertical scroll bars when this. looks messy. i have real plain text of same file, can try too. swift 3 update if let rtfpath = bundle.main.url(forresource: "sometextfile", withextension: "rtf") { { let attributedstringwithrtf:nsattributedstring = try nsattributedstring(url: rtfpath, options: [nsdocumenttypedocumentattribute:nsrtftextdocumenttype], documentattributes: nil) self.textview.attributedtext = attributedstringwithrtf } catch let error { print("got error \(error)") } } swift 4 update if let rtfpath = bundle.main.url(forresource:...

android - Always get 401 log in required from Gmail API -

ok, had working @ 1 point, wanted add silent login (optional) @ app startup. going crazy , getting following error com.google.api.client.googleapis.json.googlejsonresponseexception: 401 unauthorized { "code": 401, "errors": [ { "domain": "global", "location": "authorization", "locationtype": "header", "message": "login required", "reason": "required" } ], "message": "login required" } this occurs on line (should using "me"?) message messageresult = mgmailservice.users().messages().send("me", message).execute(); whenever try send (in case above) or read email (not shown). ultimately, want app read user emails , send on behalf. app registered, has keys, permissions, etc. i setting data (you can see various comments tried things working): mgso = new googlesigninoptio...

Mac:homebrew not installing all the Kafka scripts -

i have installed kafka-0.8.2.2 using homebrew mentioned in below link https://dtflaneur.wordpress.com/2015/10/05/installing-kafka-on-mac-osx/ i have configured 1 broker.. able run zookeeper,kafka ,consumer,producer , publish messages using producer console , see messages in consumer console... but when im trying run below script im seeing script missing.. kafka-consumer-groups.sh basically want see consumer group list number of partitions available (would know number of partitions present in broker) and when ran echo $kafka_home gives empty mean no value... but when ran brew install kafka warning: kafka-0.8.2.2 installed im concerened if kafka installed properly..please suggest able see below scripts under usr/local/bin/ kafka-console-consumer.sh kafka-console-producer.sh kafka-consumer-offset-checker.sh kafka-consumer-perf-test.sh kafka-mirror-maker.sh kafka-preferred-replica-election.sh kafka-producer-perf-test.sh kafka-reassign-partitions.sh kafka-re...

javascript - What is the point of envifying client side libraries? -

in attempt address problem behind warning coming redux stumbled across the advice explains envifying necessary step when using react or redux in order produce build optimized production use. envifying explained process of substituting node specific environment variables such process.env.node_env actual values such 'production' . accepting envifying necessary , above explanation true, confuses me since seems assume client side libraries such react , redux contain node specific environment variables. yeah know these libraries in particular popular building isomorphic/universal javascript applications find surprising. i'm understanding correctly? if there explanation of pattern need aware of process.env.node_env used outside of node? if understand advice suggest if i'm using webpack may want use plugin such defineplugin so. new webpack.defineplugin({ "process.env.node_env": process.env.node_env, }), which appear require set node_env varia...

pyqt - PyInstaller cannot find pyqt4 plugin directories -

i have pyqt application trying compile 1 exe using pyinstaller 3.1. compile exe, however, gui doesn't show upon launch (clicking exe). 1 of compilation message is: importerror: no module named site 5576 error: cannot find pyqt4 plugin directories 5576 warning: hidden import 'pyqt4._qt' not found (probably old hook) i think why ui wouldn't show up. i've add of paths has pyqt4 in pathex attribute analysis object no avail. below spec file: # -*- mode: python -*- block_cipher = none = analysis(['main32.py'], pathex=['c:/osgeo4w/apps/python27/lib/site-packages/pyqt4','./src'], binaries=none, datas=none, hiddenimports=[], hookspath=none, runtime_hooks=none, excludes=none, win_no_prefer_redirects=none, win_private_assemblies=none, cipher=block_cipher) pyz = pyz(a.pure, a.zipped_data, ciph...

.htaccess - How to restrict access to directory on server, using PHP logic? -

i have directory on server want general public not have access to. (nothing. no access php files, images, anything.) but want allow users access restricted area based on boolean value in php. is there way use php determine whether or not user can access directory, similar using htaccess file more customized logic? one of easiest way redirect restricted users homepage. <?php header( 'location: http://www.yoursite.com' ) ; exit; ?> you can allow access specific users setting boolean value in db. below solution work based on file storage location. $file = '/file.png'; // set file location $useraccess = false; if (file_exists($file) && $useraccess) { header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename=your_file.png'); header('content-transfer-encoding: binary'); header('expires: 0...

Client-server model using C socket programming (Unix Domain) -

i'm new sockets in programming language , have been reading socket using c programming. found tutorial on linuxhowtos presents implementation of socket in internet domain. page says there exists way implement sockets in unix domain. how can following code (taken linuxhowtos) can changed in order implement socket in unix domain? server.c /* simple server in internet domain using tcp port number passed argument */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> void error(const char *msg) { perror(msg); exit(1); } int main(int argc, char *argv[]) { int sockfd, newsockfd, portno; socklen_t clilen; char buffer[256]; struct sockaddr_in serv_addr, cli_addr; int n; if (argc < 2) { fprintf(stderr,"error, no port provided\n"); exit(1); } sockfd = socket(af_ine...

java - unable to locate href element within a mouse over area - Selenium web driver -

Image
i tried locate link "sign in" located in window appeared when mouse move on "mail" link on yahoo . can xpath using firebug. when used in script, doesn't work. html snippet : <a id="yui_3_18_0_4_1456816269995_943" class="c($menulink) fw(b) td(n)" data-ylk="t3:usr;elm:btn;elmt:lgn;" data-action-outcome="lgn" href="login.yahoo.com/config/…; data-rapid_p="23">sign in</a> i tried in code within main method, webelement element = driver.findelement(by.id("uh-mail-link")); actions action = new actions(driver); action.movetoelement(element).build().perform(); driver.findelement(by.id("yui_3_18_0_4_1456804882382_929")).click(); id selecter; driver.findelement(by.id("yui_3_18_0_4_1456804882382_929")).click(); it prompts error; exception in thread "main" org.openqa.selenium.nosuchelementexception: unable locate element:...

javascript - Assigning click event to multiple elements with different parameters -

i want give click event many elements of same type, function depending on position. i want click place div under clicked element. this tried , it's not working. $("#report-tabs .report-actions").each(function(){ this.click(function(){ var offset = $(this).offset(); this.next().offset({left: offset.left}); }); }); any suggestions? try this $("#report-tabs .report-actions").on('click', function(){ var offset = $(this).offset(); $(this).next().css('left', offset.left + 'px'); });

javascript regex - test is not a function -

i'm trying validate password , if ok, keep in array regular expression once. when run script in mozilla browser, following error: 'seguridadpass [i]. test not function'. know how can delete array 'comprobaciones', regex have not been used. thank help. code javscript var compmay = /[a-zÑ]/; var compmin = /[a-zñ]/; var compnum = /(?=.*\d)/; var compcaresp = /[!@#$%^&*(){}[\]<>¿¡?/|.:;_-]/; var seguridadpass = []; seguridadpass.push(compmin,compmay,compnum,compcaresp); comprobaciones = []; $('#write').keyup(function(){ var pass = $(this).val(); if(pass!=''){ for(i=0;i<seguridadpass.length;i++){ if(seguridadpass[i].test(pass)){ //alert(seguridadpass[i]); for(j=0;j<comprobaciones.length;j++){ if(comprobaciones[j]!=seguridadpass[i]){ comprobaciones.push(seguridadpass[i]); } } } } } else{ comprobaciones.splice(0,co...

How should I represent many-to-many class and professor relationship using a REST API and Zend Framework? -

i'm developing rest api using zend framework 1.12.3. i've got 3 different resources: classes, subjects , professors. each class may have assigned multiple subjects, , each subject may have assigned 1 or multiple professors. the schema this: classes: class: id: 123 name: foo subjects: subject: id: 14 name: chemistry professors: professor: id: 741 name: jeremy clarkson professor: id: 963 name: richard hammond subject: id: 16 name: physics professors: professor: id: 753 name: james may i wondering best approach list subjects , professors, both assigned , unassigned (on page actual assignment going take place). should retu...

eclipse kepler - An internal error occurred during: "JSP Index Manager: Processing Resource Events". java.lang.NullPointerException -

i getting following error while starting eclipse kepler. an internal error occurred during: "jsp index manager: processing resource events". java.lang.nullpointerexception do know can cause of problem? more details: severity: error message: internal error occurred during: "jsp index manager: processing resource events". exception stack trace: java.lang.nullpointerexception @ org.eclipse.wst.sse.core.indexing.abstractindexmanager$resourceeventprocessingjob.run(abstractindexmanager.java:1520) @ org.eclipse.core.internal.jobs.worker.run(worker.java:53) session data: eclipse.buildid=4.3.0.i20130605-2000 java.version=1.6.0_45 java.vendor=sun microsystems inc. bootloader constants: os=linux, arch=x86_64, ws=gtk, nl=en_us framework arguments: -product org.eclipse.epp.package.jee.product command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product update kepler sr1. it's known (and fixed) bug, ht...

python - Wrong text alignment in row using QTreeView -

Image
i have qtreeview (with pyqt4 ) custom , resized icons using code below, size column displaying wrong alignment/position, so: self.ui.treeview.seticonsize(qtcore.qsize(30,30)) filesystemmodel = qtgui.qfilesystemmodel(self.ui.treeview) custoniconprovider = customiconsprovider() filesystemmodel.seticonprovider(custoniconprovider) self.ui.treeview.setmodel(filesystemmodel) self.ui.treeview.setrootindex(filesystemmodel.setrootpath(forlderpath)) self.ui.treeview.setcolumnwidth(0, 250) self.ui.treeview.setcolumnwidth(1, 70) self.ui.treeview.setcolumnwidth(2, 70) i've searched http://pyqt.sourceforge.net/docs/pyqt4/qtreeview.html documentation possible fix, couldn't find evident. one way fix reimplement model's data() method value textalignmentrole includes alignvcenter flag: # python3 or sip.setapi('qvariant', 2) class filesystemmodel(qtgui.qfilesystemmodel): def data(s...

php - Using imagepng() with stream wrappers fails -

on local server, able create image gd , export using imagepng($imgresource, $path) i trying deploy aws instance, , on aws instance receive error unable open 'public://pictures/pic.png' writing: no such file or directory in mymodule_myfunction_form_submit() the directory exists - can call imagecreatefrompng($src) on image that's in directory, , creates gd resource. then, when try imagepng($img, $path) exact same gd resource same folder, spits out same error. i have set privileges on directory 777, owner/group apache:apache, yet receive same error every time. i running gd (libpng v1.2.49) on php 5.3.27 on remote server , gd (libpng v1.2.50) on php 5.4.16 on local server.

ios - UITableView Cell colour changes on scrolling query -

in application taking question in nsmutablearray , displaying on tableview row. have taken 2 buttons under each question(tableview row button). pressing yes , no button , tablerow colour changes green, yellow respectively. the problem after pressing button in particular row row turns green. after scrolling unwanted cells turning green/yellow. could please check below code , suggest - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { contentview.hidden = yes; if( tableview == mychklist) { static nsuinteger const kquestlabeltag = 1; static nsuinteger const kyesbuttontag = 2; static nsuinteger const knobuttontag = 3; uilabel *questlabel = nil; uibutton *yesbutton; uibutton *nobutton; static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] i...

asp.net - Error when Binding Data to SQLDataSource inside an Update Panel -

i trying use update panel within insertitemtemplate of formview. when "other" selected 1 dropdownlist, dropdownlist hidden. when remove update panel works fine, record created no problem. when dropdownlist inside updatepanel, following error on inserting : oracle.dataaccess.client.oracleexception: ora-01008: not variables bound. i haven't included of asp.net , code behind, please ask if you'd see else, there more bound fields , alot of data validation. here part of asp.net: <asp:formview id="fvjobs" datasourceid="fvsqldatasource" datakeynames="job_id" defaultmode="edit" oniteminserting="fvjobs_fileupl" oniteminserted="fvjobs_iteminserted" onitemupdating="fvjobs_fileup2" onitemupdated="fvjobs_itemupdated" runat="server"> <asp:dropdownlist id="insertloclist" ...

osx - Redirect (port forwarding) from en0 to bridge0 (shared connection) on Mac 10.8.5 -

i want communicate mobile app through sockets form desktop mac (app server, desktop client). using "internet sharing" share connection ethernet wi-fi. not allowed use wi-fi wireless router make easy both devices on same lan. application works between mac , diferent windows pc on same lan. can see server on ported mobile app working ok through traces. however, when try connect mobile (assigned ip 192.68.2.2), fails connect. using "ifconfig"i see ethernet interfase called "en0" , wireless "bridge0". is there way connect "bridge0"? read "natd" , "ssl" couldn't make work. furthermore, connect app windows app through desktop mac. edit: have seen natd deprecated on mountain lion ( http://support.apple.com/kb/ht5414 ) , pfctl has used. giving try that. found link directions: http://www.openbsd.org/faq/pf/rdr.html edit2: have found question similar want accomplish, other way (instead of getting packets w...

php - how to preserve data in <select> element -

for multiple steps form preserve entered value in <input> elements code: <input name="city" type="text" value="<?php echo isset($_post['city']) ? $_post['city'] : '' ?>"/> but don't know how implement <select> elements in order preserve selected option. add "selected" desired option: <select> <option value="a" <?php echo ($_post['select'] == 'a') ? 'selected' : ''; ?>>a</option>; <option value="b" <?php echo ($_post['select'] == 'b') ? 'selected' : '' ?>>b</option> <option value="c" <?php echo ($_post['select'] == 'c') ? 'selected' : ''; ?>>c</option> </select> or, if create select loop, once every options: <?php $list = array('a', 'b', 'c'); ?> ...

sql server management studio 2012 diagram relationships nice look -

Image
i trying create nice relationship diagrams using sql server management studio 2012. standard types looking bad me. i remove header "column name, condensed type" table view i not want see empty row @ bottom i not want margins (when using "autosize selected tables") here's way diagram looks: are there plugins or ways edit standard views? are there modern looking diagrams? @edit: insted of sql server management studio have used dbvis , did trick. there feature in visio reverse engineer sql server database , unfortunately dropped visio 2013 have use previous version. once reverse engineer it, able modify in whichever way need.

android - ksoap: calling a service with argument exception -

i have soap service take argument string, , call andrid code. in example code, use asynctask that. in doinbackground method call 2 service: first 1 retrieve data (with no args), , second 1 take string argument , return void. soapobject request = new soapobject(namespace, method_name); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.setoutputsoapobject(request); httptransportse androidhttptransport = new httptransportse(url); androidhttptransport.call(soap_action, envelope); vector<soapobject> result = (vector<soapobject>) envelope .getresponse(); request = new soapobject(namespace, method_name2); propertyinfo property=new propertyinfo(); property.setname("lastdate"); property.setvalue("2013/09/10 14:51:08"); property.setvalue(java.lang.string.class); request.addproperty(property); envelope.setoutputsoapobject(request); androidhttptransport.call(soap_action, envelope); but when try...

ios - How to make unique identifier from device? -

this question has answer here: ios unique user identifier [duplicate] 7 answers i want know can used , stored on server apple device (ipod touch, iphone or ipad) make unique identifier? such imei or something... need unique app can 'once same device' validation. thank you. you can use nsuuid. changes, can implement calling first time app open , saving it. if ([[nsuserdefaults standarduserdefaults] boolforkey:@"haslaunchedonce"]) { //app has launched } else { //first launch nsstring *identifierstring = [[nsuuid uuid] uuidstring]; [[nsuserdefaults standarduserdefaults] setobject:identifierstring forkey:@"uuidkey"]; [[nsuserdefaults standarduserdefaults] synchronize]; } edit: more information , options available you, check out great article .

java - How to use ListIterator effectively? -

i have method following -: public void apply(arraylist<string> tokenstream); in accept list of string tokens following - tokenstream = ("i good" , "i bad") , , want able convert these tokens in tokenstream list individual tokens , add them same list in manner after method execution on should have - tokenstream = ("i" , "am" ,"good" , "i" , "am" , "bad"), how can use listiterator solve problem? want able split individual strings in tokenstream , add them same stream object using listiterators set , remove methods, how do it? this trying do public void apply(tokenstream stream){ if (stream != null) { arraylist<string> splittedtokens = new arraylist<>(); while (stream.hasnext()) { string token = stream.next(); string[] splittokens = token.split("\\s+"); (int = 0; < splittokens.length...

android - How to get the rectangular perimeter of a view -

i have view , need it's top , bottom location on screen. run following experiment: trying figure out hit rectangle does, run following experiment int[] location = { 0, 0 }; myview.getlocationonscreen(location); rect outrect = new rect(); myview.gethitrect(outrect); then print , got outrect.top = 18 outrect.bottom = 138 location[0] = 216 location[1] = 387 i expecting outrect.top , location[1] same. so, how top , bottom location of rectangular view? getlocationonscreen() returns x , y position of view relative screen: can calculate bottom position adding value of getheight() y position. gethitrect() returns position of view relative parent, why you're getting different numbers.

php - Ajaxplorer FTP Passive Mode issues /IIS -

im using ajaxplorer ftp client upload files. small files works great, there problem bigger files (like 3g or more). apparently upload fine, when finishes receive message says file getting copied server, copying file [my file] ftp server but couple minutes later, comes this ftp_fput(): entering passive mode ([my ip address],9,132) and ajaxplorer stops copying proccess. acording ajaxplorer log error, doesnt nothing useful info guest error message=ftp_fput(): entering passive mode ([my ip address],195,201) my php.ini settings following post_max_size = 20g; upload_max_filesize = 20g; memory_limit = 100m max_input_time = -1 max_execution_time = 0 btw, im using ftp server filezilla version 0.9.41 , getting in log (000256)24/09/2013 13:52:01 - (not logged in) (192.168.1.116)> connected, sending welcome message... (000256)24/09/2013 13:52:01 - (not logged in) (192.168.1.116)> 220-filezilla server version 0.9.41 beta (000256)24/09/2013 13:52:01 - (no...

javascript - What is the optimal way to use setInterval in jquery ajax calls? -

i using jqwidgets create pie chart. , while fine , dandy , working charm. i'd update data every x number of seconds. using jquery, here code have far: function loadchart(id,name){ //chart loads here var speed = 5000, t = setinterval(reloaddata,speed); function reloaddata() { source.url = 'data.php?id='+id; var dataadapter = new $.jqx.dataadapter(source); $('#pie').jqxchart({ source: dataadapter }); console.log('reloading pie...'+globalpieid); speed = 5000; clearinterval(t); t = setinterval(reloaddata, speed); } } my issue is, if loadchart function called, instance of setinterval created, , after 3 or 4 times, chart in constant state of refresh. how optimize setinterval call 1 instance called? thanks in advance. you need clear existing interval before set new one. try following trick. function loadchart(id, name) { // use trick make our 'interval' var...

tsql - Converting SQL date formats not ending up the same -

i trying remove timestamp date values end mm/dd/yy or mm/dd/yyyy. referenced many technet, stackoverflow, , w3schools articles still can't date appear correctly. of columns in table defined datetime , come same table. i using convert statements this: convert(varchar(10), e.pd_dt, 101) 'paid date' in place of 101 have used 10 , 11, still have same issue data (below). what's happening when date value (not including time) 8 characters, getting additional character time, seen in claim adjustment date-10 , claim adjustment date-11 columns. here data: claim paid date-101 claim paid date claim adjustment date-10 claim adjustment date-11 claim adjustment date 10/23/2012 10/23/12 12:00 9/4/2012 1 9/4/2012 1 9/4/12 12:00 10/23/2012 10/23/12 12:00 9/4/2012 1 9/4/2012 1 9/4/12 12:00 10/23/2012 10/23/12 12:00 9/4/2012 1 ...

Can a Node.js application connect to bluetooth on Android? -

can node.js application connect bluetooth device on android? if so, think efficient , stable way it? thanks this module should helpful (i have never used though): https://github.com/eelcocramer/node-bluetooth-serial-port

java - replace array value with hashmap values -

hashmap<string, string> apos = new hashmap<string, string>(); apos.put("i'm","i am"); apos.put("can't","cannot"); apos.put("couldn't","could not"); string[] st = new string[]{"i'm","johny"}; iterator itr = apos.entryset().iterator(); (int = 0; < st.length; i++) { while((itr).hasnext()) { if (itr.equals(st[i])) { st[i].replace(st[i],??????(value of matched key)) } } } i want compare string hashmap , rerplace word hashmap value if matches key. above trying do. please me should write in place of key. help appreciated. thanks you don't need iterate on map find out whether array value key in map. use map#containskey() method that. so, rid of iterator. if (map.containskey(s[i])) you don't nee...

php - json delete square brackets -

this php script <?php require('medoo.min.php'); header('content-type: application/json'); $database = new medoo('brickx'); $datas = $database->select("customer", ["companyname", "phonenumber"]); $jsonresponse = array("customers"=> array()); array_push($jsonresponse["customers"], $datas); echo (json_encode($jsonresponse)); ?> outputs kind of json: {"customers":[[{"companyname":"company1","phonenumber":"+567890789"},{"companyname":"company2","phonenumber":"5678905678"}]]} however need rid of square brackets , like {"customers":{"companyname":"company1","phonenumber":"+567890789"},{"companyname":"company2","phonenumber":"5678905678"}} any suggestions? $datas array, want instead: $array =...

Selenium Webdriver - sendKeys() not sending all keys - Java -

i use selenium webdriver java , i've found problem. when try send text textfield, sends first char of two. tried setting javascriptexecutor, same thing happened. chromedriver running , working fine. code below: public void sendnumbertochrome (int number){ textfield.clear(); // textfield set, it's classic input field max. 10 characters system.out.println(string.valueof(number)); // prints example 94 textfield.sendkeys(string.valueof(number)); // "9" appears in browser } i tried send character character: string[] arr = string.valueof(number).split("(?<!^)"); // splits number character character (string s : arr){ system.out.println(s); // prints 9 , 4 textfield.sendkeys(s); // 9 appears thread.sleep(100); // maybe browser can not work fast, wait before sending next character } javascriptexecutor send 1 character , every few minutes crashes (don't know why), not using it. interesting - when this: ...

c# - Error in Sending Email via a SMTP Client -

this may trivial couldn't figure out why getting error message when run code. looked of relative questions on same website eg sending email through gmail smtp server c# none of them helpful. willing please? using different assemblies acceptable. if got working solution appreciated. error message = smtp server requires secure connection or client not authenticated. server response was: 5.5.1 authentication required. learn more at here code system.net.mail.mailmessage message = new system.net.mail.mailmessage(); message.from = new mailaddress("bob@googlemail.com"); message.to.add("bob@hotmail.com"); message.subject = "hello"; message.body = "hello bob "; message.deliverynotificationoptions = deliverynotificationoptions.onfailure; smtpclient smtpclient = new smtpclient("smtp.gmail.com", 587); smtpclient.enablessl = true; smtpclient.deliverymethod = smtpdeliverymethod.network; smtpclient.usedefaultcredenti...

nasm - 16 bit Assembly Program -

so i've started learning 16 bit assembly using nasm on windows machine. if got little program i've created asks user input , determines if input within range (0 9). if is, goes on see if value divisible three, if not it's supposed loop , ask user value. here's code: org 0x100 bits 16 ;jump on data declarations jmp main input: db 6 db 0 user: times 6 db ' ' cr_lf: db 0dh, 0ah, '$' message: db 'please enter number select between 0 , 9:','$' errormsg: db '***', 0ah, 0dh, '$' finalmsg: db 'number divisible 3!', 0ah, 0dh, '$' finalerrormsg: db 'number not divisible 3!', 0ah, 0dh, '$' outputbuffer: db ' ', '$' ;clear screen , change colours clear_screen: mov ax, 0600h mov bh, 17h ;white on blue mov cx, 00 mov dx, 184fh int 10h nop ret move_cursor: mov ah, 02 mov bh, 00 mov dx, 0a00h int 10h ret ;get u...

php - Application doesn't enter the loop -

i have code : <?php error_reporting(e_all); ini_set('display_errors',1); $wynik = 0; $licznik = 0; wykonaj(); function wykonaj() { echo '1'; for($i = 1; $i == 404; $i++) { $temp = $i / 100; echo $temp; if(is_int($temp*1.5)) { global $wynik, $licznik; $wynik++; //$liczba[$licznik] = $i + ($i/100)*1.5; $licznik++; } } } echo "ilosc wynikow : $wynik<br/>liczby sa nastepujace :"; ?> my application returns : 1ilosc wynikow : 0 liczby sa nastepujace : so think there error (logical ?), because line - echo $temp; isn't displayed yet, 1 before loop displayed. tried lot of things, not find solution. why errors ? compiler doesn't tell anything. it enter loop if $i equal 404 , it's set 1 right off won't happen. syntax in for loop like: for([set vars]; [set conditional]; [set increment]) the loop runs when conditional true.

javascript - How to tweak jQuery animation for the element to stay in the middle? -

i have jquery mobile page , want animate save button on page lose half of width/height , animate original size. function animateme() { var originalheight = $("#btnsave").height(); var originalwidth = $("#btnsave").width(); $("#btnsave").animate( {"height": originalheight / 2, "width": originalwidth / 2}, { duration: "fast" } ); $("#btnsave").animate( {"height": originalheight, "width": originalwidth}, { duration: "fast" } ); } the animation works fine, hoping button collapse middle, instead collapses top/left location (as 1 expect). how can animate button collapse middle , back? this better using css3 animation , scale transform, instead of relying on jquery's animate . beside other advantages using css3 animations this, performance should better. here's rough example, give idea: http://jsfi...

guava - How can I use PriorityBlockingQueue with ListeningExecutorService? -

since guava's listeningexecutorservice implemented wrapping existing executorservice, 'decorates' task intercepting execute() method. means if want use custom priorityqueue on underlying executorservice, comparator "sees" decorated task listenablefuturetask object instead of original. is there way hold of task wraps? queue's comparator can use tasks weight determine ordering? i assume you're concerned submit() rather execute() ? (see bottom of response.) with listeningexecutorservice moreexecutors.listeningdecorator (the kind of wrapper refer to), you're out of luck. listeningdecorator , executorservice implementations, wraps input submit in futuretask . normal solution problem implement abstractexecutorservice , override newtaskfor return custom object. should work here, too. you'll reimplementing listeningdecorator , trivial wrapper around abstractlisteningexecutorservice , trivial wrapper around abstractexecutorservice . ...

sql - Alternative to nested select statements -

Image
i have following tables structure: currently filtering users implemented pretty complex nested sql query (moreover automatically generated linq). looks approximately like: select (select (select ( infinity here...)))) is there way simplify filtering process? please, take account there different characteristic types. here sub-queries conditions samples: ... cv.text '%aaa%' , c.id = 5 ... cv.imageid not null , c.id = 10 ... cv.number > 5 , c.id = 33 etc... will appreciate , ideas(change db structure, change technology, etc...), thanks! as describing it, query should this select u.id users u exists ( select * characteristicvalues cv cv.text '%aaa%' , cv.characteristicid = 5 , u.id = cv.userid ) , exists ( select * characteristicvalues cv cv.imageid not null , cv.characteristicid = 10 , u.id = cv.userid ) , exists ( select * characteristicvalues cv ...

ios7 - In App Purchase not working on Xcode 5, iOS 7 simulator -

it appears in app purchase on simulator has again been broken. able submit skproduct, never appropriate callback. any insight others great... [[skpaymentqueue defaultqueue] addtransactionobserver:self]; [[skpaymentqueue defaultqueue] addpayment:skpayment]; no response observer delegate callback. according release notes xcode 5.0: storekit (in-app purchases) not work in simulator. 13962338 https://developer.apple.com/library/prerelease/ios/releasenotes/developertools/rn-xcode/index.html#//apple_ref/doc/uid/tp40001051 the simulator documentation doesn't list storekit being 1 of api's not available maybe temporary? https://developer.apple.com/library/ios/documentation/ides/conceptual/ios_simulator_guide/testingontheiossimulator/testingontheiossimulator.html#//apple_ref/doc/uid/tp40012848-ch4-sw15

javascript - Storing $.getJSON() response to local var -

this question has answer here: how return response asynchronous call? 21 answers i need use function several times , wanted avoid writing same method on , over. wanted use $.getjson() response , store in var returned. way can call method. function startfilter(){ var grid = []; $.getjson('data/griddata1.json',function(json){ grid = json; console.log(grid); }); console.log(grid); return grid; } the grid var set inside of .getjson not outside of .getjson. ideas why, , if more info needed let me know? the ajax calls async. here how things positioned in time. function startfilter(){ var grid = []; // (1) $.getjson('data/griddata1.json', function(json){ // (2) grid = json; // (5) console.log(grid); // (6) }); c...

java - error on my jsp page -- constant string too long -

i trying include jsp page contains huge content content area, getting error : constant string long , unable compile class jsp. any work around problem ? the simple solution problem splitting huge content multiple jsp pages , including them dynamicly (using <jsp:include> ) 1 single jsp.

html - Javascript code to get the background color is not working -

i trying design highlighting system used highlight rows in html table on mousehover code using given below, reason doesn't work, please help <!-- row highlight javascript --> <script type="text/javascript"> window.onload=function() { var tfrow = document.getelementbyid('tfhover').rows.length; var tbrow=[]; var original; (var i=1;i<tfrow;i++) { tbrow[i]=document.getelementbyid('tfhover').rows[i]; tbrow[i].onmouseover = function() { original = tbrow[i].style.backgroundcolor; this.style.backgroundcolor = '#f3f8aa'; }; tbrow[i].onmouseout = function() { this.style.backgroundcolor = original; }; ...

SQLAlchemy equivalent to Active Record has_one_through -

sqlalchemy's docs great little overwhelming @ times coming rails , active record. given active record relationship set sqlalchemy equivalent establish relationship through intermediary table? specifically given basic active record example below i'm trying understand how define equivalent relationship in sqlalchemy can allow account sqlalchemy model tied accounthistory model. i'm not clear if i'm supposed using mapper function , feel i'm missing simple in sqlalchemy. class supplier < activerecord::base has_one :account has_one :account_history, through: :account end class account < activerecord::base belongs_to :supplier has_one :account_history end class accounthistory < activerecord::base belongs_to :account end perhaps misunderstood workings of has_one_through . in retrospect think looking this: class supplier(base): __tablename__ = 'supplier' id = column(integer, primary_key=true) class accounthistory(bas...