Posts

Showing posts from August, 2014

Multidimensional Array in javascript -

i have this: var selectathing = { "id" : "productname" , "5" : "abc" , "29" : "efg" , "28" : "hij" , "11" : "xyz" "23" : "efg" , "15" : "hij" , "40" : "xyz" }; $.each(selectathing, function(key, value) { $('.myselect') .append($('<option>', { value : key }) .text(value)); }); now showing this: <select> <option value="5">abc</option> <option value="11">abc</option> <option value="15">abc</option> <option value="23">abc</option> <option value="28">abc</option> <option value="29">abc</option> <option value="40">abc</option...

elasticsearch - SOLR \ Boost phrases docs -

let's wanna search docs term1 term2 term3 how can boost docs these terms closer? proximity tight me want docs term1 , term2 example... i know there solr param take query , wrap in phrase boost? you can use bool query can contain combination of queries may include exact match, partial match or proximity match. different types of queries take @ this . also, please go through this . article proximity matching in es. thanks

ruby - convert mysql result to array or hash -

sql query:- class test def self.execute_mysql(host, database, query) net::ssh.start('test.com', user, forward_agent: true) |ssh| ssh.exec!("mysql -ppassword -utestuser -h #{host} #{database} -a --execute '#{query}'") end end command run:- result = test.execute_mysql('app', 'sample', 'select * foo') result string:- id name address age 1 ram 25 2 sam 30 3 jack india 32 . . . . 100 peterson 27 result variable returns string class. suppose returns 100 records.how can loop through each record ? are looking this? > result => "id name address age\n1 ram 25\n2 sam 30\n3 jack india 32" > result.split(" ").each_slice(4){|e| print e } => ["id", "name", "address", "age"]["1", "ram", "us", "25"]["2", "sam", "us", "30"]["3", "jack...

javascript - How to add custom code to prestashop -

i trying add following code prestashop site able display google trusted site badge: <!-- begin: google trusted stores --> <script type="text/javascript"> var gts = gts || []; gts.push(["id", "store_id"]); gts.push(["badge_position", "bottom_right"]); gts.push(["locale", "english_australia"]); gts.push(["google_base_offer_id", "item_google_shopping_id"]); gts.push(["google_base_subaccount_id", "item_google_shopping_account_id"]); gts.push(["google_base_country", "item_google_shopping_country"]); gts.push(["google_base_language", "item_google_shopping_language"]); (function() { var gts = document.createelement("script"); gts.type = "text/javascript"; gts.async = true; gts.src = "https://www.googlecommerce.com/trustedstores/api/js"; var s = document.getel...

javascript - HTML CSS using fixed elements and resize -

i html/css/javascript beginner. i working on project. using nodejs + websockets. haveing problem styling. i have 3 fixed elements. need them resize on resize in browser window. i working on styling in scratchpad.io . this code have included styling part. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" /> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <link href="http://fonts.googleapis.com/css?family=corben:bold" rel="stylesheet" type="text/css"> <link href="http://fonts.googleapis.com/css?family=rancho&effect=shadow-multiple" rel="stylesheet" type="text/css"> <style> body { padding-top: 5px; text-align: center; background: ...

ng-map is not compiling in angularJS -

i included directives such ngmap,nvd3 in ang var app = angular.module('myapp', [ 'nvd3','ngmap']); angular.module('myapp'). controller('mainctrl', ['$scope', '$filter', '$compile', '$http', '$q', '$log', function($scope, $compile, $timeout, $http) { var template = '<div class= "chartsdiv">' + ' <div class="col"> <p class="graphtitle"> netspend on time </p> <nvd3 id = "chart3" options="netspendovertime_options" data="netspendovertime_data"></nvd3> </div>' + ' <div class="col"> <p class="graphtitle"> google map </p> <map center="43.07493,-89.381388" zoom="8"> </map> </div>' + ' </div>'; }); ularjs application. in controller prepared...

java - How do disable SSLv3 in Apache HttpClient -

with reference poodle vulnerability, need force code use only tlsv1 , not sslv3 . have set sslprotocols="tlsv1" in server.xml file, , set system property "https.protocols" "tlsv1". though works connections created using httpsurlconnection, doesnt solve connections created using org.apache.commons.httpclient.httpclient java version 1.5+ my sample code follows connection initiation multithreadedhttpconnectionmanager httpconnectionmanager = new multithreadedhttpconnectionmanager(); connparams = httpconnectionmanager.getparams(); connparams.setdefaultmaxconnectionsperhost(10); connparams.setmaxtotalconnections(75); connparams.setconnectiontimeout(1000); connparams.setsotimeout(30000); httpconnectionmanager.setparams(connparams); clientparams = new httpclientparams(); clientparams.setparameter(httpmethodparams.retry_handler, new defaulthttpmethodretryhandler(0, true)); try{ protocol customhttps = new protocol("https", new easysslp...

c# find words in sequence in richtextbox -

i have 2 rich text boxes . first text box contains input , second text box display output of found words input: name umer father name waqar output: umer found found name found is found father found found the output not want. i want output below : my found name found is found umer found found father found name found is found waqar found my code is: private void button1_click(object sender, eventargs e) { if (richtextbox1.text.contains("umer")) richtextbox2.appendtext("\numer found"); if (richtextbox1.text.contains("my")) richtextbox2.appendtext("\nmy found"); if (richtextbox1.text.contains("name")) richtextbox2.appendtext("\nname found"); if (richtextbox1.text.contains("is")) richtextbox2.appendtext("\nis found"); if (richtextbox1.text.contains("father")) ...

Add edge between two documents in ArangoDB -

it should easy operation can't find how achieve this. have 2 documents different collections , want link them using new edge existing collection. i'm trying use edge-collection.save function this: edge-collection.save(for s in sy filter s._key=403560128,for in im filter i._key=353031872, points) doesn't work. how can this? edge-collection.save() not expect aql statements trying insert. expecting raw _id attributes , and thir parameter json object containing additional data edge. store edge described in example can execute following command: edge-collection.save("sy/403560128", "im/353031872", points); ^^^^^ ^^^^^ ^^^^ sourceid targetid json

javascript - CasperJS POST AJAX is not working -

i'm working on sending data through ajax. code working, ajax request not working. data sent not saved. i have tried using websecurityenabled: false , still doesn't work. this how i'm trying it: var casper = require("casper").create({ loglevel: "error", //debug verbose: true, pagesettings: { loadimages: true, // not load images loadplugins: false, // not load npapi plugins (flash, silverlight, ...) websecurityenabled: false // ajax } }); ........................ var save_file="http://aaa.com/js_save.php"; for(var ii=0; ii<title_link.length; ii++) { this.echo(title_link[ii]); //var save_data = tlink.serialize(); var save_data = {"title":"title", "link":title_link[ii]}; jsonobject_fields = this.evaluate(function(save_file) { params = save_data; try { return json.parse(__utils__.sendajax(save_...

linux - DHCP Option 77 - malformed option -

i'am developing industrial application based on open source dhcp client. i setting custom dhcp client class id (dhcp option 77) ipconfig /setclassid "local area connection" "some_custom_class_id" and in wireshark capturing dhcp handshake. custom class id present in dhcp request, wireshark has option 77 info highlighed error "malformed option". referring rfc 3004 standard found each instance of user class data should have 1 octet prefix of length can fixe problem , dismiss dhcp wireshark error. the problem know version of wireshark detect error version 1.10.6 other version can't detect version 1.6.5. any ideas on this? bug in wireshark ? first: dissection of dhcp option 77 first included in wireshark 1.10 wireshark 1.6 , wireshark 1.8 don't know option , don't show error option. second: i'm bit unclear question: are asking why wireshark 1.6 doesn't show error correctly shown in wireshark-1.10 ? ...

python - textblob on django + apache on aws gives MissingCorpusError -

i have aws linux running apache , django. have installed textbob extension , works through python shell. however, when use in views.py gives me missingcorpuserror. i have downloaded corpus ( python -m textblob.download_corpora ) , module works fine python shell. can problem? have been stuck on thing since couple of days now. below error message get, looks missing required data feature.to download necessary data, run python -m textblob.download_corporaor use nltk downloader download missing data: http://nltk.org/data.htmlif doesn't fix problem, file issue @ https://github.com/sloria/textblob/issues .

C# Changing value in dll.config isnt changing at runtime -

i have configured boolean variable in project's settings file when compile, in output folder see variable in .dll.config, follows: <setting name="showstats" serializeas="string"> <value>true</value> </setting> in code refer properties.settings.default.showstats want able change .config file , write there false or true , , have value reflected in runtime. seems changing settings window in visual studio work in runtime. changing notepad isnt working. last value set in vs settings window. what doing wrong here? dlls don't have config files. entry process has config file. basically: entries need copied dll-named config file app.config, or exe-named config file. further: these values read @ startup; if changing while running , won't (unless process chooses restart monitoring configuration - asp.net this).

vbscript - ADODB reference from an HTA application -

i need hta application shows data mdb using ado technology. here's how code starts: function getdata() dim pathname pathname = "d:\\wp\\ado\\adoexamples.mdb" dim con 'as new adodb.connection dim rs 'as new adodb.recordset set rs = new adodb.recordset rs.cursortype = adopenstatic rs.locktype = adlockoptimistic set con = new adodb.connection i error: class undefined adodb. apparently, it's because need include adodb references. how do in .hta file? you can't create ado objects way in vbscript. use createobject() instead: pathname = "d:\\wp\\ado\\adoexamples.mdb" dim con 'as new adodb.connection dim rs 'as new adodb.recordset set rs = createobject("adodb.recordset") rs.cursortype = adopenstatic rs.locktype = adlockoptimistic set con = createobject("adodb.connection") also, vbscript doesn't recognize ado named constants adopenstatic or adlockoptimistic , need define them yourself: con...

ios - Sprite Kit Select SKNode below another SKNode -

i'm creating ios app sprite kit & i'm trying select (ontouchbegan) sknode lies below sknode. structure : firstlayer(sknode) - secondlayer(sknode) & 3rd layer (sknode). i'm trying select secondlayer , move around ontouchmove. current problem touch recognises 3rdlayer. can me ? to elaborate on scott's comment, zposition property of sknode layer lies on, higher layer numbers being "closer" front of screen. therefore if want have nodeb on top of nodea , nodea have zposition higher number of a, such as: nodea.zposition = 1 nodeb.zposition = 2 if set zposition of node when create it, can set conditional check on zposition of touched node in 'touchesbegan' method. following above example, if touch nodea , not nodeb , check zposition of node being touched equal 1 : -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [[event alltouches] anyobject]; cgpoint location = [touch locationinnode:...

jquery - HTML5 form validation and file upload in Google Apps Script HTML Service -

i'm developing gas using html service , running roadblock. i'm trying create can add data form elements (i.e., name , email) google sheet the form upload file specific google drive before 1 , 2, form should validate input based on html5 here's (almost) working code: code.gs function doget(e) { return htmlservice.createhtmloutputfromfile('index.html'); } function uploadfiles(form) { try { var ssid = '-------ssid-------'; var dropboxid = '-------driveid-------'; var folder = docslist.getfolderbyid(dropboxid); var blob = form.myfile; if ( boolean(blob) ) { var file = folder.createfile(blob); file.setdescription("uploaded " + form.myname); } var sheet = spreadsheetapp.openbyid(ssid).getsheets()[0]; var lastrow = sheet.getlastrow(); var targetrange = sheet.getrange(lastrow+1, 1, 1, 3).setvalues([[ form.myname, form.mymail, file.geturl() ]]); return "file uploaded succes...

internationalization - Using Yii2's default messages -

i can't figure out, how use yii's default messages, without overwriting them message command . i have 2 translation categories: app , data . i'd use default messages, "are sure want delete item?" , "(not set)" yii2 core, if use yii::t('yii', 'are sure want delete item?') , run yii message command, creates yii.php file in messages folder token. part of config: 'i18n' => [ 'translations' => [ 'app*' => [ 'class' => 'yii\i18n\phpmessagesource', 'basepath' => '@app/messages', ], 'data*' => [ 'class' => 'yii\i18n\phpmessagesource', 'basepath' => '@app/messages', ], ], ], how should set config use built in texts , not overwrite them? you don't have anything. yii...

Add new activity without menu or action bar in android studio? -

Image
in android studio 0.8.14 can't find way add new activity without menu. android studio force me have menu new activity if don't want menu must delete myself. is new standard in android activities should have action bar menu? or forgot add real blank activity template android studio? unfortunately, android studio not have boilerplate code activity without menu. however, can make own boilplate. if in folder \plugins\android\lib\templates\activities in android studio installation, see templates everything. can make own template, , show in menu when making new project. i'm working on 1 activity without menu. i'm done, started in fact when saw question. happy after finish. edit: ok found easier way. in same folder, see folder called emptyactivity. don't know why doesn't show in list of activites when making project. however, if copy , paste folder \plugins\android\lib\templates\activities folder, rename whatever want, edit template.xm...

c# - Why Web Service is converting XmlDocument parameter to System.XML.Linq.XElement Parameter -

this question has answer here: vs2010 confuses system.xml.xmlelement system.xml.linq.xelement? 3 answers ide: vs 2010 c# .net 4.0 i creating simple web service take xmldocument parameter public class mywebservice : system.web.services.webservice { public void receivexml(xmldocument xdoc, string strxmlfilename) { xmlreceiver.receive(xdoc, strxmlfilename); } } when ran service , added projectb using add service reference, , went reference file found public void receivexml(system.xml.linq.xelement xdoc, string strxmlfilename) { receivexmlrequest invalue = new receivexmlrequest(); invalue.body = new receivexmlrequestbody(); invalue.body.xdoc = xdoc; invalue.body.strxmlfilename = strxmlfilename; } here not getting have written xmldocument type parameter receive why refrence.cs file created function s...

Update MRTG year graph -

i have migrated old 2.16 mrtg environment in rhel 6 machine new 2.17.4 while ago , keep having same problem, day, week , month graphs updated should crontab year graph not. when first updated system didn't copied begining images /var/www/html/mrtg started generated , ran cfgmaker creat new mrtg.cfg file. copied old mrtg.cfg file , .png day, week, month , year pictures /var/www/html/mrtg , ran indexmaker command make change happen , 1 day. year graphs updated once day whenever crontab graph goes old historical year graph had removed. does know how make change permanent? haven't tried recompile mrtg going next step. i have found answer, have update ".old" , ".log" mrtg files generates historic data. https://lists.oetiker.ch/pipermail/mrtg/2007-october/033185.html

PHP : Work with stdClass() for create a json -

my goal read complex sqlite database php , , create json represents database according rules to decided use stdclass() class problem : when call test() function block3 not added test code (i tried represent situation @ best, of course here not use database , foreach) $obj = new stdclass(); $obj->block1 = array(); $obj->block1[0]["prop1"] = "test"; $obj->block1[0]["prop2"] = "test"; $obj->block1[0]["prop3"] = "test"; $obj->block1[0]["prop4"] = "test"; $obj->block2 = array(); for($i=0;$i<3;$i++) { $obj->block2[$i]["sxsxs"] = "test"; $obj->block2[$i]["98u98u"] = "test"; $obj->block2[$i]["jhjh"] = "test"; $obj->block2[$i]["oiuoiu"] = "test"; //this works , want in test function //$obj->block2[$i]["block3"] = array(); test($obj->block...

c# - How can I bind the rowheight between two DataGrids? -

Image
i have 2 datagrids same number of rows. can row in datagrid1 has more text in , rowheight bigger in datagrid2. tried this: (int = 0; < datagrid1.items.count; i++) { datagrid1.scrollintoview(datagrid1.items[i]); datagridrow row = (datagridrow)datagrid1.itemcontainergenerator.containerfromindex(i); binding bindingheight = new binding(); bindingheight.mode = bindingmode.twoway; bindingheight.source = row.actualheight; bindingheight.path = new propertypath(datagridrow.heightproperty); datagrid2.scrollintoview(datagrid2.items[i]); datagridrow row2 = (datagridrow)datagrid2.itemcontainergenerator.containerfromindex(i); bindingoperations.setbinding(row2, datagridrow.heightproperty, bindingheight); } any ideas how can rows have same height? edit: problem want bind rowheight of single row. how looks @ moment: want specific row in datagrid2 has rowheight of...

ruby on rails - How to cache data to use in a dashboard page -

in application, after user logs in, redirect dashboard page, can return every time during session. data in page not change during time, need cache somehow. is rails responsible me, or need manually? for now, dashboard display, among others, search: #how many men? @men = horario.joins(:paciente). where(:data => date.today). where(pacientes: {sexo: masculino}).count @total = horario.where(:data => date.today).count @women = @total - @men if you, i'd use fragment caching dashboard part.

java - Apache DefaultExecutor and Ping command for JTextArea -

i newbie in java apache utilities. i studying apache's defaultexecutor method following code. import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import org.apache.commons.exec.commandline; import org.apache.commons.exec.defaultexecuteresulthandler; import org.apache.commons.exec.defaultexecutor; import org.apache.commons.exec.executeexception; import org.apache.commons.exec.logoutputstream; import org.apache.commons.exec.pumpstreamhandler; public class pingexampleapacheexec { public static void main(string[] args) { // commandline commandline = new commandline("ping"); commandline.addargument("/n"); commandline.addargument("5"); commandline.addarguments("/w 1000"); commandline.addargument("127.0.0.1"); // executor defaultexecutor executor = new defaultexecutor(); try { // logoutputstrea...

java - Accessing object fields added to model map in jsp page -

in spring web project, have added class object in model map . class public class projectdetailsbean { private string title; private string type; private string addedby; private string status; private string updatedon; private string relavantbranch; // getters , setters here } after setting attributes projectdetailsbean object instance, add model map in controller class. epb instance. model.addattribute("projectdetails", epb); now need access fields of projectdetails in jsp page. values need assigned separate input fields. cannot figure out how that. please tell me how that. thank you! you need access through expression language ${projectdetails.title} ${projectdetails.addedby} ....... on

excel - Preserve a custom number format without having applied it -

i have observed if click on cell ->manage cell formats->customformats->add new format new format saved, if reformat cell standard text format, previous custom format deleted excel. can add custom number format in excel , retain without applying cell? you can apply format cell in hidden sheet.

php - Wordpress get_posts() fetch next batch of posts -

i'm using get_posts() function fetch batch of posts custom post type, sorted id, modify posts , fetch next batch. i have following code: <?php require_once('wp-load.php'); $temp_list_of_products_array = get_posts( array('post_type' => 'sale', 'numberposts' => 10 ) ); $temp_list_of_products_array_length = count( $temp_list_of_products_array ); ($xt = 0; $xt < $temp_list_of_products_array_length; $xt++) { $temp_product_id = $temp_list_of_products_array[$xt]->id; $temp_product_untranslated_field = get_post_meta($temp_product_id, 'wpcf-product-details', true); $temp_product_translated_field = get_post_meta($temp_product_id, 'wpcf-translated-product-details', true); $temp_product_description_language = 'en'; if ($temp_product_translated_field == null) { $temp_product_translated_contents = google_translate_text($temp_product_untranslated_field,...

java - How to encode string in android & decode string on servlet? -

i trying encode parameters in android before sending servlet. used base64 class of android & able encode.but on servlet there no anroid.util try decode through org.apache.axiom.om.util there comman class both servlet & android. not using jdk 1.8. thanks in advance.

combining python with fortran, trouble with tutorial -

i'm following tutorial http://www.sam.math.ethz.ch/~raoulb/teaching/pythontutorial/combining.html i use same code program hwtest real*8 r1, r2 ,s r1 = 1.0 r2 = 0.0 s = hw1(r1, r2) write(*,*) 'hw1, result:',s write(*,*) 'hw2, result:' call hw2(r1, r2) call hw3(r1, r2, s) write(*,*) 'hw3, result:', s end real*8 function hw1(r1, r2) real*8 r1, r2 hw1 = sin(r1 + r2) return end subroutine hw2(r1, r2) real*8 r1, r2, s s = sin(r1 + r2) write(*,1000) 'hello, world! sin(',r1+r2,')=',s 1000 format(a,f6.3,a,f8.6) return end c special version of hw1 result c returned argument: subroutine hw3_v1(r1, r2, s) real*8 r1, r2, s s = sin(r1 + r2) return end c f2py treats s input arg. in hw3_v1; fix this: subroutine hw3(r1, r2, s) real*8 r1, r2, s cf2py intent(out) ...

javascript - Hangman updating OO value array -

i writing hangman game in php , js , having problems. have 2 arrays, answer array has correct letters, , user answer array contains users correct guesses. the user answer guesses array starts out underscores no guesses have been correct _ _ _ i update array , put correct letter correct field when user guesses correctly _ _; when var_dump inside updateanswer() function user answer array has changed , added correct letter, when pull returnuseranswer array has not. ps. library being called once __construct not problem. <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class word { private $answer; public $usranswer; function __construct(){ $this->answer = array('c','a','t'); $this->usranswer = array('_','_','_'); } function returnuseranswer(){ return $this->usranswer; } function updateanswer($letter,$try){ $change = array($try => $letter); $this->usranswe...

ios - How to show AutoLayout controls? -

Image
my question is: method bring auto layout gui controls? first app pictured below doesn't have auto layout controls popup when image clicked in storyboard... app no autolayout gui controls app autolayout gui controls

mysql - Python - MySQLdb: ValueError - unsupported format - although the use of the execute substitution -

i'm trying update blob images in database python-mysqldb package error: valueerror: unsupported format character ',' (0x2c) @ index 64 i've added images time ago execute substitution tools example this: set connection db: db = mysqldb.connect( host="127.0.0.1", port=0815, user="javert", passwd="ureyes", db="some_db") cur = db.cursor() read image files: images = [ open( image_file, 'rb') image_file in folder ] image1, ..., image6 = images insert images: command = """insert database_table (column1, ..., column6) values (%s,%s,%s,%s,%s,%s)""" cur.execute( command, args=( image1, ..., image6)) db.commit() now i've replaced insert command following , described error: """update database_table set column1=%s, column2=%s, column3=%s, column4=s%, column5=%s, column6=%s id=table_row_id""" thank help! column4=s%, should column4=%s, ...

ios - App crashes on iPad device but working on simulator -

Image
i have device udid & client reported app crashing on device & not able start application. the client device ios version 7.1.2 also not having crash report.(asked crash report) now referring ( iad works on simulator crash on device(ipad) ): assuming reason behind might library, so making iad.framwork optional & handling codes related trick? **update: unfortunately cause of crash -[__nscfstring containsstring:]: unrecognized selector sent ios version fault & not device fault. got resolved. sorry iad blaming or trying blame. long live iad. thanks** first of - need crash details. without it, nobody you. integrate crash reporter sdk: crashlytics or this.

javascript - Angular directive bind to height of element -

i new angular , want able bind height of element. in current case want bind css bottom on el1 height of el2 . not share common controller. how can this? <div id='el1' ng-controller='controller1' style='bottom: {{theheightofel2}}'></div> <div id='el2' ng-controller='controller2' style='height: 573px;'></div> i found answer on here looked promising couldnt see how extend allow me specify element wanted bind to. in generic case, guess asking directive bind property x on element 1 property y on element 2. update i have created directive isn't quite working yet. fires correctly @ start when try test manually updating css of el2 watch doesnt fire m.directive('bindtoheight', function ($window) { return { restrict: 'a', link: function (scope, elem, attrs) { var attributes = scope.$eval(attrs['bindtoheight']); var targetelem = ang...

unicode - TeXShop setting of UTF-8 is broken -

for long time, tried set xelatex work utf-8 correct. silly me! a couple of days ago have figured out, xelatex working correct. when edit or create file using vi example, works charme. but when editing or creating latex file using texshop tranforms german umlauts from ... \begin{document} \maketitle üöäßÜÖÄ ... into \utf{00fc}\utf{00f6}\utf{00e4}\utf{00df}\utf{00d6}\utf{00c4}\utf{00dc} as result of xelatex .tex receive ... <name>.tex:<line number>: undefined control sequence. l<line number>\utf {00fc}\utf{00f6}\utf{00e4}\utf{00df}\utf{00d6}\utf{00c4}\utf{00dc}% where filename , position. not relevant! i have set save file unicode(utf-8) in texshop preferences (texshop ->preferences...->source) not help. on other computer have same version installed. on 1 saving document correct. even reinstalling did not help. the file saved using strange \utf{...} notation instead of character. how can fix encoding when saving? thank in...

css - How to stop css3 animation at the end? -

im playing around css3 translatey , i'm not abel stop animation @ end. html: <ul id="nav" class="nav-ctn"> <li><a href="?type=about">about</a></li> <li><a href="?type=projects">projects</a></li> <li><a href="?type=media">media</a></li> <li><a href="?type=schedule">schedule</a></li> <li><a href="?type=contact">contact</a></li> </ul> css: .tr-up { -moz-animation: tr-up 0.5s ease-in-out; -o-animation: tr-up 0.5s ease-in-out; -webkit-animation: tr-up 0.5s ease-in-out; animation: tr-up 0.5s ease-in-out; -moz-animation-fill-mode: forwards; -o-animation-fill-mode: forwards; -webkit-animation-fill-mode: forwards; animation-fill-mode: forwards; } @-moz-keyframes tr-up { { ...

javascript - Bootstrap pop over is not closing -

i using bootstrap pop on when click 1 button gots opened , closed same button click again. i tried add close button beside of title , has done when clicked on close button not closing. my code: $('#emailpopover').popover({ placement:'right', trigger: 'click', html: true, title:'voter variables'+ '<button type="button" id="close" class="close" onclick="$(this).popover("hide");">&times;</button>' }); try using &quot; instead of quotation marks this: $('#emailpopover').popover({ placement:'right', trigger: 'click', html: true, title:'voter variables'+ '<button type="button" id="close" class="close" onclick="$(&quot;#emailpopover&quot;).popover(&quot;hide&quot;);">...

ruby - uninitialized constant Ability Rails -

i have gone through different solutions given problem none of them working please don't try close question duplicate. i have role column in users table. user can admin or user , need put permissions on base of user role using cancan . want give permissions admin. logged in admin when access /users error uninitialized constant ability , when remove load_and_authorize_resource cancan permission doesn't work.my ability class looks like class ability include cancan::ability def initialize(user) #abort("message goes here") user ||= user.new # guest user #abort('some user') if user.role == 'admin' can :manage, :all elsif user.role == 'user' can :manage, micropost |micropost| micropost.try(:owner) == user end can :update, user |users| users.try(:owner) == user end else can :read, :all end end end in userscontroller having class userscontroller <...

Adding css files in spring mvc -

i want add css files in spring mvc project.i using myeclipse. i adding <mvc:resources mapping="/resources/**" location="/web-inf/resources/" /> in spring-servlet.xml when going run getting exception exception javax.servlet.servletexception: servlet.init() servlet spring threw exception org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:104) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:261) org.apache.coyote.http11.http11processor.process(http11processor.java:844) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:581) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:447) java.lang.thread.run(thread.java:619) root cause org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: cannot locate beandefinitionparser element [resources] offending resource: servle...

internet explorer - max-content not working in IE 10, 11, 12 and probably the rest to come? -

i having trouble ie behaving. wanting navigation centralised. the navigation have odd link changed , wanting use max-content; regardless of in navigation container width right size without me having work out every time. this works perfect in chrome, ff, opera , pretty every browser except ie. have not been able find legit or full answer ask: why ie not support width: max-content? also, there way force ie behave? thanks, lee as of writing, status.modern.ie reports css intrinsic & extrinsic sizing module level 3 not supported in version of ie, it's " under consideration " it may supported @ point in future. if like, can happen voting support @ ie uservoice site. the object-fit polyfill seems possible alternative, you'd need test against specific needs. hope helps... -- lance

c# - How can I certify the client? -

i have following scenario: client connects on tcp server. client sends credentials server (password, username, mac address). server validates credentials , handles client if data correct. but right? want ensure 1 (on user profile registered) computer can use client. means client , computer must identified. i'm sure suggestion above pretty wrong. how can better? this tricky problem, comments pointed out, users may fake machine information pretend computer. what recommend hash machine information (e.g. sha-256 ), isn't obvious what information use identify computer. of course can learned attackers in multiple ways (monitoring, disassembly, etc). here tips on data use uniquely identify machine. pick several characteristics, put them , hash them. of course means if user changes e.g. hard drive (and use serial identify computer), cannot connect anymore. suppose need offer "re-create key" function anyway in case users switch or modify computer. this a...

php - How to change the "while" loop to retrieve only 3 top records from MySQL database -

i set query select * from, used while loop print out retrieved records , works fine. need print out top 3 of records, there way change while loop make work way. any on appreciated, thx while($row = $alerts_query->fetch_object()){ echo "<div class='panel'> <div class='panel-heading'> <h3 class='panel-title'>" . $row->ticket_title . " <a href='clientpanel.php?tab=dashboard=" . $row->ticketid . "' aria-hidden='true' type='button' class='close pull-right'>x</a></h3> </div> <div class='panel-body'>" . $row->ticket_description . " <br /> <br /> <span style='color: #999'>reported: " . $row->ticket_date . "</span> </div> </div>"; } do not limit in while loop (though, it's possible). change sql inste...

javascript - Get originalTarget from tab load event MDN -

i'm trying originaltarget dom following example : gbrowser.addeventlistener("load", function(aevent){ s.handleloadbrowser(aevent);}, true); handleloadbrowser : function (aevent){ var w = aevent.originaltarget.defaultview; } i create event listener tab load: var tab = gbrowser.addtab("www.google.com"); tab.addeventlistener("load", function(aevent){ s.handleloadtab(aevent) }, true); handleloadtab : function (aevent){ var w = aevent.originaltarget.defaultview; } here error: "typeerror: win undefined". how dom object tab event load ? regarding first example, should work: did similar: https://gist.github.com/noitidart/9287185#file-bootstrap-js-l98 difference do: gbrowser.addeventlistener("load", s.handleloadbrowser, true); regarding second example: var tab = gbrowser.addtab("www.google.com"); tab.addeventlistener("load", function(aevent){ s.handleloadtab(aevent) }, true); cant...

jquery - Using image value to choose an image from an array and display it (Javascript) -

i have bunch of pictures , want display bigger version of them when clicked. have right now: <div class="gallery"> <div> <img src="content/imggallery/img1.jpg" class="oldimg" value="0"> </div> <div> <img src="content/imggallery/img2.jpg" class="oldimg" value="1"> </div> <div> <img src="content/imggallery/img3.jpg" class="oldimg" value="2"> </div> </div> and javascript/jquery: $(function() { var docheight = $(document).height(); var imagedata = new array (3); imagedata[0]="0.jpg"; imagedata[1]="1.jpg"; imagedata[2]="2.jpg"; $(".oldimg").click(function(){ $("body").append("<div id='overlay'></div>"); $("body").append("...

yii - how to check already exist entry in database -

my default controller function public function actionaddnewcategories() { $model = new addnewcategory(); $model->category_name=strip_tags(trim($_post['categoryname'])); $model->category_description=strip_tags(trim($_post['categorydescription'])); $model->save(false); $category_list=invoice::getcategoryname(); $test=""; $test = ' <option value="">select category</option>'; foreach($category_list $value ){ $test .= "<option >{$value['category_name']}</option>"; } echo $test; } model function public function getcategoryname() { $id = yii::app()->db->createcommand() ->select('category_name') ->from('add_new_category c') ->queryall(); return $id; } you can add unique rule addnewcateg...

java - Media player not working properly -

i making , app in press buttons play sounds.it seems work @ first after 5-6 press stops playing sounds. here code public class mainactivity extends actionbaractivity { private imagebutton pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9, pad10, pad11, pad12; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); pad1 = (imagebutton) findviewbyid(r.id.pad1); pad2 = (imagebutton) findviewbyid(r.id.pad2); pad3 = (imagebutton) findviewbyid(r.id.pad3); pad4 = (imagebutton) findviewbyid(r.id.pad4); pad5 = (imagebutton) findviewbyid(r.id.pad5); pad6 = (imagebutton) findviewbyid(r.id.pad6); pad7 = (imagebutton) findviewbyid(r.id.pad7); pad8 = (imagebutton) findviewbyid(r.id.pad8); pad9 = (imagebutton) findviewbyid(r.id.pad9); pad10 = (imagebutton) findviewbyid(r.id.pad10); pad11 = (imagebutton) findviewbyid(r.id.pad11); pad12 = (imagebutton) ...