Posts

Showing posts from June, 2011

php - how to include one JSON into another JSON? -

my first json is: come java url, here using php, in php iam calling java url. { "categoryid":"painting", "subcategoryid":"residential", "alternatives": [1,2,3,4,5], "criterias":["price","quantity","yom","company"], "answerss":[["1000","12343","4543","","4645646"],["12","23","34","","45"],["2014","","2000","1990","2005"],["xyz","","abc","jkl","mno"]] } my second json is: iam generating using jquery. {"criterias":"location"} how can include second json first json criterias. you need convert first json string object , add new property it. if java, can use google's gson library gson gson = new gson(); json

Android Google Maps Info window -

i have add multiple markers on map , , show info windows @ same time . when add last marker previous info window markers automatically gets hidden.can tell me solution how can this? that not possible infowindows noted 2nd sentence on this page . might try using this library instead put text displaying in infowindow in marker itself. careful showing information on screen @ once, don't want busy!

Omnipay how to add new gateway -

does know how add new payment gateway omnipay? i read blog https://groups.google.com/forum/#!topic/omnipay/j7oeqqsb95a i followed following steps: cloned omnipay repository using composer inside vendor/omnipay/ directory, added new directory layout per stripe example now when trying include gateway, see following error: scream: error suppression ignored ( ! ) fatal error: class '\omnipay\mygateway\gateway' not found in c:\wamp\www\root\omnipay\vendor\omnipay\common\src\omnipay\common\gatewayfactory.php on line 79 you don't need change inside vendor/ directory. just create class \omnipay\mygateway\gateway in regular src/lib directory, , make sure can autoloaded composer. can use omnipay\omnipay::create('mygateway') create instance of class (or call new \omnipay\mygateway\gateway() ).

c# - WPF binding to a Usercontrol and getting an error -

im starting wpf, sorry if cant explain well, , have hours trying solve how bind collection custom grid named pagingdatagrid. the pagingdatagrid in customersearchcontrol binding griditems itemssource, when excecute searchcommand griditems gets updated nothing else changes. i following error: system.windows.data error: 40 : bindingexpression path error: 'griditems' property not found on 'object' ''pagingdatagridviewmodel' (hashcode=54151655)'. bindingexpression:path=griditems; dataitem='pagingdatagridviewmodel' (hashcode=54151655); target element 'pagingdatagrid' (name='me'); target property 'itemssource' (type 'ienumerable') customersearchcontrol: <usercontrol x:class="namespace.customersearchcontrol" ... > <control.datacontext> <binding path="customersearchviewmodel" ... /> </control.datacontext> <dockpanel lastchildfill=&

html - Video tag at Chrome overlays on top -

other browsers ok, in chrome, video plays on top, ignoring z-index. following code, , looks strange in chrome. there absolutely positioned 'iuview_4', shows under video. what's wrong in chrome? there way handle? <style> #page {background-color : rgb(255,255,255); position : relative; z-index : 0; width : 100.0%; margin : auto; height : 1300.0px; } #movie {background-color : rgb(0,198,245); top : 94.0px; z-index : 0; width : 521.0px; left : 131.0px; height : 242.0px; } #view {height : 70.0px; width : 100.0px; background-color : rgb(0,164,89); z-index : 1; top : 62.0px; overflow : hidden; left : 435.0px; position:absolute; } </style> <body > <div> <div id='page' > <div id='movie' > <video width=100% height=100% poster='res/gazzetta_thumbnail.png' autoplay> <source src="http://www.sketchin.ch/en/wp-content/themes/sketchin2013/as

javascript - How to "export" transformations applied to an SVG object, to another SVG object, using Raphael.js? -

how can take transformations i've applied far svg image object (i.e. consecutive scaling, dragging, rotation transformations) , apply them new svg image added page? the svg element want read transformations of, looks this: <svg height="598" version="1.1" width="462" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;"> <desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">created raphaël 2.1.2</desc> <defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></defs> <image x="139.26470588235293" y="180.5" width="226.47058823529412" height="150" preserveaspectratio="none" xlink:href="./gallery/viewport/cmf_52a45ec2e13207277.jpg" transform="matrix(0.8877,0.4605,-0.4605,0.8877,146.0177,-87.5714)" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"

windows - How To add group Everyone for a Folder and give all Permissions to it Via Commandline -

i using bat file add group folder , give permissions it. the bat file contains: icacls %homedrive%\inetpub\wwwroot /t /grant everyone:f but throwing : access denied error why? how rectify or alternative command same...?

How to mount a folder on amazon ec2 instance with private key using sshfs -

i trying mount folder on amazon ec2 instance desktop folder using sshfs . the problem not able figure out how give option private key (awskey.pem). normally ssh using ssh ec2-user@{amz-ip-address} -i {path amzkey.pem} but sshfs has no such options. saw -f option , tried sshfs ec2-user@{amz-ip-address}:{amz-folder} {my mount dir} -f {path amzkey.pem} this gave me error "read: connection reset peer" please let me know if has tried before. from documentation : if using non-default key names , passing -i .ssh/my_key , won't work. have use -o identityfile=/home/user/.ssh/my_key , full path key.

How to download a file with cgi/python? -

i have working cgi/python. want ask question below: how download file cgi/python? i want when page loading file specified in url downloaded. i have googled in many days can't until resolve problem. anyone me, many thanks. import urllib urllib.urlretrieve(url, filename)

java - Taking turns picking endpoints, trying to get max -

say there array of integers. take turns person picking endpoints of array (either first or last element). objective implement algorithm find maximum score possible (always being first act). example: int[] arr = {3, 0, 4, 11, 1}; pick 3 arr = {0, 4, 11, 1} opponent picks 0 arr = {4, 11, 1} pick 4 arr = {11, 1} opponent picks 1 arr = {11} pick 11 arr = {} maxpossible = 3 + 4 + 11 = 18 i got recursive solution working, inefficient. i want find dynamic programming solution (i new it). any ideas? here naive recursive implementation. believe it's o(2^n) public int findbest(list<integer> a) { return findbesthelper(a, 0, true); } public int findbesthelper(list<integer> a, int score, boolean myturn) { if(a.size() <= 0) return score; list<integer> removefirst = new arraylist<integer>(a); removefirst.remove(0); list<integer> removelast = new arraylist<integer>(a); removelast.remove(remov

javascript - Dropzone with normal form -

my problem must combine normal form dropzone.js drag&drop upload. after user clicks submit-button, ajax-request send data php-script if there values in inputs. but how can combine files dropzone , ajax-request? send both, when user clicks button. if drag file in zone file send. autoprocessqueue: false this make it, file doesn't send if user drag file in zone. solution needed: user fills form, drag file in zone , if user click on button, values , files send ajax-request. some demo code: http://jsfiddle.net/wqp5b/ i had same problem solved it. can checkout link dropzone --> https://github.com/enyo/dropzone/wiki/combine-normal-form-with-dropzone they have given want there things added in have given not making whole form clickable , other things . code below works fine me form.html <form method="post" action="upload.php" class="dropzone" id="mydropzone" enctype='multipart/form-data'> //remember

c++ - Is this function a good candidate for SIMD on Intel? -

i'm trying optimize following function (simplified bit, it's loop program spends lot of time): int f(int len, unsigned char *p) { int = 0; while (i < len && p[i] >= 32 && p[i] <= 127) { i++; } return i; } i think optimized vector instructions, bit of research, looks sse not meant working @ byte level. program targets 64-bit intel cpus on osx. there clever bit-twiddling trick i'm not seeing let me work on 64 bits @ time? llvm -o3 doesn't clever optimizations. update: the simd code fastest on benchmark (depending on size of input), reason app overall slower simd naïve code or bit-twiddling trick. context, application finding length of subsequences of ascii strings in stream of input terminal emulator. ascii strings special "fast path" treatment. mark 1 answer correct both great. did make 1 small improvement bit twiddling, removing if statement doing this: while (i < len - 8) { uint64_t b

jQuery Ajax call runs in error but firebug shows 200 ok and returned json -

i've read lot of threads ajax problems, i've still got no clue, cause problem: i'm trying call restful service (internal) via ajax large json-string. edit: how resolved problem - know not quite solution, since can't change on webservice use: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> jquery(document).ready(function(){ jquery.support.cors = true; jquery.ajax({ url: "<internalpage>", datatype: 'json' }) .error(function(xhr, err, status) { console.log(xhr + err + status); }) .then(function(data) { alert("success me"); $.each(data.portalservices, function(index, value) { $("#someid").append('<li>' + value.name + '</li>'); }); }); }); </script> </head> <body>

Clojure: how to merge several sorted vectors of vectors into common structure? -

need help. stuck on intuitively simple task. i have few vectors of vectors. first element of each of sub-vectors numeric key. parent vectors sorted these keys. example: [[1 b] [3 c d] [4 f d] .... ] [[1 aa bb] [2 cc dd] [3 ww qq] [5 f]... ] [[3 ccc ddd] [4 fff ddd] ...] need clarify key values in nested vectors may missing, sorting order guaranteed. i need merge of these vectors unified structure numeric keys. need now, key missed in original vector or vectors. like this: [ [[1 b][1 aa bb][]] [[][2 cc dd]] [[3 c d][3 ww qq][3 ccc ddd]] [[4 f d][][4 fff dd]]...] you can break problem down 2 parts: 1) unique keys in sorted order 2) each unique key, iterate through list of vectors, , output either entry key, or empty list if missing to unique keys, pull out keys lists, concat them 1 big list, , put them sorted-set: (into (sorted-set) (apply concat (for [vector vectors] (map first vector)))) if start list of vectors of: (def v

Android Getting continuously Bluetooth signal strength of paired devices -

Image
i listing paired devices,and work want bluetooth signal strength of paired devices...i know use rssi cannot implement continuously in app.. plz me giving suitable code code...my code here... public class security extends fragment implements onclicklistener{ private bluetoothadapter ba; private set<bluetoothdevice>paireddevices; arraylist<string> mylist = new arraylist<string>(); //private object imageview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.security, null); ba = bluetoothadapter.getdefaultadapter(); /* starting bluetooth*/ on(v); paireddevices = ba.getbondeddevices(); //length=4; // int j=1; for(bluetoothdevice bt : paireddevices) { mylist.add(bt.getname()); length=j; j++; bt.getbondstate(); } return v; } @override pub

android - How make transparent AppCompat style? -

my activity style must appcompat theme. so make custom style , set activity style in manifest. but black background shown. below custom theme <style name="transparenttheme" parent="@style/theme.appcompat"> <item name="android:background">@null</item> <item name="background">@null</item> <item name="android:windowbackground">@null</item> <item name="android:colorbackgroundcachehint">@null</item> <item name="android:windowcontentoverlay">@null</item> <item name="android:windowistranslucent">true</item> <item name="android:windowanimationstyle">@null</item> </style> use @android:color/transparent instead of @null

Which class should be used to create TLS connection in java. Socket class or SSLSocket class? -

i trying create simple java client connect port 5223 of presence server(openfire). presence server docs tell me port supports secure tls connections. so try connect 5223 port using below code. sslsocketfactory factory=(sslsocketfactory)sslsocketfactory.getdefault(); sslsocket socket= (sslsocket)factory.createsocket("host",5223); bufferedreader reader=new bufferedreader(new inputstreamreader(socket.getinputstream(),"utf-8")); bufferedwriter writer =new bufferedwriter(new outputstreamwriter(socket.getoutputstream(),"utf-8")); writer.write("some data"); writer.flush(); char r0[]= new char[600]; reader.read(r0); system.out.println(r0); this worked fine , see that(in wireshark) data sent responce received encrypted. next tried below code socket socket=new socket("host", 5223); bufferedreader reader=new bufferedreader(new inputstreamreader(socket.getinputstream(),"utf-8")); bufferedwriter writer =new bufferedwriter(new

ruby - Change Rails 4 production.rb constants based on request.url -

please can point me in right direction i'm sure simple problem, causing me go round in circles.i have 3 domains .com .com.au .co.nz i'm trying keep single code base maintenance. i've done manual localisation work to change titles, contact details etc based on url , using request.original_url , stripping out relevant parts , setting constants in application controller (site, email, telephone etc). it works fine, except config.action_mailer.smtp_settings in production.rb. these should change localised email account used (info@...com or .com.au etc) i can't constants initialised before environment loaded. makes perfect sense why it's not working, have no idea how fix it. i've tried putting in initializers , application.rb , setting in production.rb itself. if move code anywhere out of application controller no method error on request.original_url . is there way of pulling out mailer settings can exposed variables? or production.rb load

jquery - MVC - Data between ajax and controller -

i sending id value using ajax controller nothing appears on browser. ajax part $(function () { $("#personeledit").click(function () { $.ajax({ type: "post", url: "/gorev/gorevpersonel/", data: "{'id': '@{@model.id}'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: onsuccessyekiler, failure: function (response) { alert(response.d); } }); }); }); function onsuccessyekiler(response) { if (response.d != "false") { eval(response.d); } } controller part [httppost] public string gorevpersonel(string id) { if (id.equals(null)) { return ""; } else { string retval = ""; string choval = "$('#s2_multi_value').val([{0}]).trigger('ch

How to transfer file from php to java using php-java-bridge -

i trying upload file, front end application in php , backend engine in java. both communicate through php-java_bridge. my first action was, when file posted php page, retrieve content. $filedata= file_get_contents($tmpuploadedlocation); and pass information java ejb façade accepts byte array savefilecontents(byte[] contents) here how in php converted $filedata byte array. $bytearraydata = unpack("c*",$filedata); and called java service (java service object retrieved using php-java-bridge) $javaservice->savefilecontents($bytearraydata); this works fine if file size less, if size increase 2.9 mb, receive error , hence file contents not saved on disk. fatal error: allowed memory size of 134217728 bytes exhausted //this php side error due unpack i not sure how this, above method not accurate, please have few limits. the engine(java) responsible saving , retrieving contents. php-html front end application, thing php php communicate java using php-

ruby on rails 4 mass assignment -

i have: a model user common data such email, password, first_name, last_name a model student specific data such faculty_id, etc.. what want have possibility modify student's profile, e.g change faculty , credentials. found out accepts_nested_attributes_for should me that. have: class user < activerecord::base has_one :student has_one :header has_one :admin has_many :progresses, :through => :student accepts_nested_attributes_for :student end class student < activerecord::base belongs_to :user belongs_to :group has_one :specialization, through: :group has_many :progresses scope :activated, lambda {(where("users.activated = 'off'"))} self.per_page = 1 end class admin::studentscontroller < admincontroller before_action :set_user, only: [:show, :edit, :update, :destroy] def index @students = student.joins(:user).joins(:group).paginate(:page => params[:page]).all end def show end def edit end de

java - GWT and dynamic tabs -

is possible create panel dynamic added tabs in gwt using tabpanel or tablayoutpanel . my requirements: first tab not closeable , has celltable. when select row in celltable, new tab created. newly created tab can closed. question: how create architecture in gwt using mvp style , uibinder? why not? if problem in gwt, can dive level below javascript , make need. any panel can dinamically changed. if layout panel can forcelayout() @ moment. can add() or insert() new items panel , use different selfmade widgets tabs (you have lot of possibilities how add or insert: add(widget child, widget tab) or add(widget child, safehtml html) ). here example how made extgwt, logic identical have made widgets tabs (that can closed , not).

Wordpress PHP MySQL query with a multidimensional array -

when run below php in wordpress without foreach printed multidimensional array. when use foreach returns error 500 trying loop through results able select each name , push array. if assist me looping through array, great! array ( [0] => stdclass object ( [term_taxonomy_id] => 26 [taxonomy] => product_brand [name] => authentic cheese [slug] => authentic-cheese ) [1] => stdclass object ( [term_taxonomy_id] => 27 [taxonomy] => product_brand [name] => robot [slug] => robot ) ) php $q2 = "select t.term_taxonomy_id, t.taxonomy, e.name, e.slug wp_term_taxonomy t inner join wp_terms e on t.term_taxonomy_id = e.term_id taxonomy = 'product_brand'"; $r2 = $wpdb->get_results($q2); print_r($r2); foreach ($r2 $row) { echo $row['name']; } you have array of objects in result

ember.js - Is "basic" a reserved route name in Ember? -

i have route in ember app called "basic" corresponding name of api endpoint. this route doesn't work - links don't render template. here's jsbin demonstrating failure: http://emberjs.jsbin.com/hisoxadi/1 js: app = ember.application.create(); app.router.map(function() { this.route('basic'); this.route('test'); }); app.indexroute = ember.route.extend({ model: function() { return ['red', 'yellow', 'blue']; } }); templates: <script type="text/x-handlebars"> <h2> welcome ember.js</h2> {{#link-to 'index'}}index{{/link-to}} {{#link-to 'basic'}}basic route{{/link-to}} {{#link-to 'test'}}test route{{/link-to}} {{outlet}} </script> <script type="text/x-handlebars" data-template-name="basic"> basic route here </script> <script type="text/x-handlebars" data-template-na

php - Customer reviews and calendar entries, etc in a database -

how things customer reviews stored in database? cant imagine there rows each item , columns each review 1 product may have 2 reviews , may have 100+ - id presume stored in separate file reviews surely not 1 file per item! dont know enough storing data able figure 1 out myself! a similar situation online calendar - there information each appointment (time, duration, location, etc) , there can many of these on each day, every day, users! logical way have table each user appointments in, @ same time seems illogical because if have 1000+ users, thats alot of tables! basically id know common/best practice way of storing 'big dynamic data'. customer reviews can stored using 2 tables in one-to-many relationship. suppose have table containing products/articles/whatever worth reviewing. each of them has unique id , other attributes. table "products" +-------------------------------------+ | id | name | attribute1 | attribute2 | +---------------------------

javascript - How to show and hide rows using several select buttons -

i have problem showing , hiding rows, when select 2 select buttons @ once. using 1 button, can show/hide correct rows. using both buttons @ once, no rows displayed. where logical error in code? please check: http://jsfiddle.net/xeyjz/83/ <div ng-controller="myctrl"> <p> <input type="checkbox" ng-init="shownew=false" ng-click="shownew =! shownew"><span> show new only</span> <br> <input type="checkbox" ng-init="showold=false" ng-click="showold =! showold"><span> show old </span> </p> <table border="1"> <tr ng-repeat="person in persons" ng-class="{'newp':person.newp, 'oldp':person.oldp}" ng-hide="(!person.newp && shownew) || (!person.oldp && showold)"> <td>{{ person.id }}</td> <td>{{ per

android - show navigation drawer on physical menu button -

i want show navigation drawer when user clicks on physical menu button, override menu button following : @override public boolean onkeydown(int keycode, keyevent event) { if ( keycode == keyevent.keycode_menu ) { // code here show navigation drawer return true; } return super.onkeydown(keycode, event); } but don't know should show navigation drawer inside method. p.s (i know not thing , team leader insist it) drawerlayout.opendrawer(gravity.left) looking for. btw don't think bad think do, since lot of people not familiar drawer yet.

oracle - SQL: AVG with NULL Values -

as far understood avg() function ignores null values. so avg(4,4,4,4,4,null) --> 4 in case don´t want happen. i need solution that: avg(4,4,4,4,4,null) --> 3,33 without replacing null values directly in table itself. there way this? use coalesce() return real value of 0 null columns: select avg(coalesce(some_column, 0)) ...

java - android select time interval using a timeline control -

i need control forces user select date , time within specific intervals. i see datapickerdialog has setmin , setmax, it's not enough. the best way have selectable timeline 5 minutes resolution, min , max date, , possibility hide interval between min , max. i hoping find custom control in network, have not found anything

wordpress - Order by post meta not working -

i trying use custom sortable column 'book' post type. my pre_get_posts function isn't sorting. each post has existing meta value 'downloads_orders', numbers. have verified code being run (by dumping out query) add_action( 'pre_get_posts', 'my_book_orderby' ); function my_book_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( 'orderby'); if( 'downloads_orders' == $orderby ) { $query->set('meta_key', 'downloads_orders'); $query->set('orderby', 'meta_value_num'); } } any ideas why isn't sorting? edit: realized none of sorting working. not default title column. edit: 'post types order' plugin conflicting, causing no sorting work. deactivated , above code working try this: add_action( 'pre_get_posts', 'my_book_orderby' ); function my_book_orderby( $query ) { if( ! is_admin() )

java - h:inputTex with f:ajax listener not fired in p:datatable and p:columns -

i have p:datatable <h:form id="forms" styleclass="ttablas" prependid="false"> <p:datatable var="row" id="list" value="#{bb.datatable}" rowindexvar="i"> <p:column headertext="id"> <h:outputtext value="#{row.id}" /> </p:column> <p:columns var="fecha" value="#{bb.lfechaentradavigor}"> <f:facet name="header"> <h:outputtext value="#{fecha}" /> </f:facet> <h:outputtext value="#{row.getcoste(fecha)}" styleclass="#{row.isvalido(fecha)?'vigor':''}" rendered="#{!row.isupdatable(fecha)}"> <f:convertnumber groupingused="true" minfractiondigits="2" /> </h:outputtext> <h:inputtext value="#{bb.valor}" rendered="#{row.isupdatable(fe

Extjs Grid- disable some checkbox on special row -

i have simple gridpanel column using xtype:checkcolumn ext.define('ext.abc.grid', { extend: 'ext.grid.panel', columns: [ { text: 'id', dataindex: 'id' }, { text: 'status', dataindex: 'abc', xtype: 'checkcolumn', /*viewconfig: { getclass: function(value, metadata, record){ }) },*/ listeners:{ beforecheckchange: function(column, row, checked, opts){ }, checkchange:function(cc,ix,ischecked){ } } } ] }); i want disable checkboxes on special row column id. possible? how can that? thanks. i took code of ext.grid.column.checkcolumn , , think less intrusive way achieve want to: use tweaked model prevent modification on desired condition. override column renderer add disabled class record not

asp.net - Users kick off to the login page -

i have asp.net application hosted on iis6.0 working fine . last week asked admin team free space on server. after application start showing strange behavior. users getting kicked off login page(idle or working) after 15 minutes. have tried setting on iis6.0 , web.config , appear correct on there. please help.

asp.net - How to make a hidden gridview -

i want keep grid view hidden until , unless search button been clicked <td class="style2"> <asp:textbox id="txtbkcgry" runat="server" width="233px"></asp:textbox> </td> <td class="style3"> auther</td> <td class="style4"> <asp:textbox id="txtathr" runat="server" width="235px"></asp:textbox> </td> <td rowspan="2"> <asp:button id="button1" runat="server" text="search" width="143px" onclick="button1_click" /> </td> </tr> <tr> <td class="style1"> book name</td> <td class="style2"> <

jquery - execute javascript which is returned via ajax request in RoR -

i have such rails rendering javascript view: $("##{@organization.id}-organization-introtext").hide(); $("##{@organization.id}-organization-full").append("#{escape_javascript(render @organization)}").hide().fadein('slow').focus(); and via it, example such data: $("#9-organization-introtext").hide(); $("#9-organization-full").append("<h2 id=\'magenta\'>\n shell - Автосервис\n<\/h2>\n<div>\n shell - Автосервис\n <br>\n <br>\n<\/div>\n<div>\n <strong>\n Контактная информация:\n <\/strong>\n <p>\n 8 (0152) 510 884\n 8 (029) 265 38 09\n <\/p>\n <p>\n <script type=\"text/javascript\" charset=\"utf-8\" src=\"//api-maps.yandex.ru/services/constructor/1.0/js/?sid=srxoh8zh15xlrmfvdc91ycedqr23_vul&width=600&height=450\"><\/script>\n <\/p>\n <p>\n г.Ростов-на-До

javascript - SELECT box: On IE item is added to OptGroup instead of root. FF ok -

Image
i've got behaviour bit strange select box , optgroup : use optgroup , try add @ end single item expect out of optgroup . ff expected ie adds optgroup with code : fiddle (note: jquery use .ready method, can't use in project) <select id="selectbox"> <optgroup label="optgroup1"> <option>aaaa</option> </optgroup> </select> $(document).ready(function() { var select = document.getelementbyid("selectbox"); option = document.createelement( 'option' ); option.value = option.text = "test"; select.add( option ); }); the result different in ie , ff ie: ff: note : i'm using javascript add item because i'm using gwt. way gwt adds item select . this works in ie , chrome, should work in ff: $(document).ready(function() { var select = document.getelementbyid("selectbox"); option = document.createelement( 'option' ); o

login - Geny motion credential. I am not able to loggin in geny motion credential -

i not able loggin in geny motion credential. can 1 me in finding way login in genymotion credential can download virtual devices. or 1 provide me free credentials can try here on own machine. i have face same problem...just go email id's inbox , confirm account after confirmation able log genymotion.

mysql - Move a column into a dedicate table -

in addition this questions move download column separate table " downloads " contains info , timestamp of download here's the fiddle as result have id referer domain code downloads ========================================================================= 1 example.com/sitea example.com codeone 2 2 example2.com/sitea example2.com (null) 2 3 example.com/siteb example.com codetwo 0 4 example2.com/siteb example2.com (null) 2 this current attempt without downloads column select users.*, codes.code users left join (codes inner join codes_users on codes.id = codes_users.code_id) on users.id = codes_users.user_id group users.id; edit furthermore group domain with group users.domain; how downloads count of referer: id referer domain code dl_for_domain

Understand an gif is animated or not in JAVA -

i have gif image , able detect whether gif animated gif or not using java. question detection rather displaying gif. i see mime type of animated gif isn't different of static gif. how can it? you need imagereader. if size 1 not animated, above animated. check out: public snippet() { file f = new file("test.gif"); imagereader = imageio.getimagereadersbysuffix("gif").next(); imageinputstream iis; try { iis = imageio.createimageinputstream(f); is.setinput(iis); int images= is.getnumimages(true); } catch (ioexception e) { e.printstacktrace(); } }

Bootstrap 3 carousel, extra space in the left and right -

Image
here index page <body id="home"> <section class="container"> <header class="row"> <?php include "components/php/header.php" ?> </header> <div class=" row"> <div class="col col-lg-12"> <?php include "components/php/main_carousel.php" ?> </div> </div> </section> <!-- container --> <!-- scripts --> <script src="js/jquery-v1.10.2.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="components/javascript/custom.js"></script> </body> here carousel <div id="main_carousel" class="carousel-slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#main_carousel" data-slide-t

android - Adb connection Error EOF + Sending jdwp tracking request failed -

in eclipse(latest version) when running android project ddms error again , again: adb connection error:eof [2014-03-06 11:44:58 - devicemonitor] sending jdwp tracking request failed! i have tried killed adb server, reseting it, cleaned project, restarted, chmoded file permissions ddms , android files in tools folder its driving me nuts... my platform mac osx ver:10.9.1 /any appreciated

Php preg_match apache custom logs -

hello have logs example: x.xx.xxx.xx - username [06/mar/2014:14:22:24 +0400] "get /folder/folder1/file.php http/1.1" 200 246 i use apache-log-parser.php standard pattern preg_match log file wrong. preg_match("/^(\s+) (\s+) (\s+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\s+) (.*?) (\s+)\" (\s+) (\s+) (\".*?\") (\".*?\")$/", $line, $matches); please reg_exp . just remove last parts: preg_match("/^(\s+) (\s+) (\s+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\s+) (.*?) (\s+)\" (\s+) (\s+)$/", $line, $matches);

ios - Rerequesting the Publish Permission -

i have problem when re- request publish permission ( manage_notifications ) after getting readpermission. the use case if read permission asks user authorize manage_notifications permission if user don't allow , try again next time app crashes saying terminating app due uncaught exception 'com.facebook.sdk:invalidoperationexception', reason: 'fbsession: not valid reauthorize while previous reauthorize call has not yet completed.' i checking fbsession open before requesting publish permissions. below code if([[fbsession activesession] isopen] ){ if ([fbsession.activesession.permissions indexofobject:@"manage_notifications"] == nsnotfound) { // if don't have permission, request [fbsession.activesession requestnewpublishpermissions:@[@"manage_notifications"] defaultaudience:fbsessiondefaultaudienceonlyme completionhandler:

scala - Broken pipe exceptions from Redis client Jedis -

we have redis client calls play framework application. redis calls being made actor using akka schedular. scheduler runs every 60 secs makes redis calls along other jdbc calls. after scheduler has run few mins start seeing following log files , app stops responding redis client calls. first encounter redis pointers, appreciated. redis.host = localhost redis.port = 6379 redis.timeout = 10 redis.pool.maxactive =110 redis.pool.maxidle = 50 redis.pool.maxwait = 3000 redis.pool.testonborrow = true redis.pool.testonreturn = true redis.pool.testwhileidle = true redis.pool.timebetweenevictionrunsmillis = 60000 redis.pool.numtestsperevictionrun = 10 exception details: redis.clients.jedis.exceptions.jedisconnectionexception: java.net.socketexception: broken pipe @ redis.clients.jedis.connection.flush(connection.java:69) ~[redis.clients.jedis-2.3.0.jar:na] @ redis.clients.jedis.jedispubsub.subscribe(jedispubsub.java:58) ~[redis.clients.jedis-2.3.0.jar:na] ............

c# - Support for NLog 2.1 -

i want upgrade nlog version 2.1. version of common logging library should use? i using common logging version 2.0 nlog 2.0. replaced nlog v2.0 2.1 not work. help? i error - failed obtaining configuration common.logging configuration section 'common/logging'. you should use common.logging.nlog20 you'll have add assembly redirect : <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="common.logging" publickeytoken="af08829b84f0328e" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.1.2.0" newversion="2.1.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="nlog" publickeytoken="5120e14c03d0593c" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.1.0.0" newversion="2.1.0.0" /> </dependent

Error when calling a python script from expect script -

i have python script called mypython.py has logger module imported. mypython.py called expect script called myexpect.exp. issue when add logger.info('test') statement in mypython.py , call myexpect.exp myexpect.exp fails. if replace logger.log('test') statement print statement working fine. content of python script import os import sys import datetime import time import argparse import logging logging.basicconfig(format="%(asctime)s %(message)s", datefmt='%m/%d/%y %i:%m:%s %p', level=logging.info) logger = logging.getlogger(__name__) *** *** def main(): args = get_args() print 'this print statement ' + args.test_arg ### ok logger.info("this logger statement" + " " + args.test_arg) ### has issue content of expect script #!/usr/bin/expect -- #exec python mypath/stratus/bin/mypython.py "test" ">@stdout" exec python prnt_stmt.py -t arg_from_exp &q

compare differences in a row between two identical tables in mysql -

i have 2 identical tables different set of data's, compare words in single field against multiple rows of same column in table b , let me know percentage of matches against each id example: the following entries in table a row1: 1, salt water masala row2: 2, water onion maggi milk the following entries in table b row1: 1, salt masala water row2: 2, water onion maggi the desired result row1: match 100% (all 3 words available different order) row2: match 75% 1 word not match out of 4 words. it great if me same. although easier accomplish in application code, possible via couple of mysql functions: delimiter // drop function if exists string_splitter // create function string_splitter( str text, delim varchar(25), pos tinyint) returns text begin return replace(substring_index(str, delim, pos), concat(substring_index(str, delim, pos - 1), delim), ''); end // drop function if exists percentage_of_matches // create function percentage_of_

asp.net - REST or SOAP WCF service on secure internal network NO SSL -

i have problem service writing. we have webapp hosted on internal secure network. there requirement provide service expose our web app business functionality client consume in order create native tablet app. the mobile device use vpn onto network. access our webapp, user need use user name , password. ie. there no ssl. username , password stored in our db in custom set (no asp membership, etc). now, have raised lack of ssl issue, has been shot down, , in charge of such matters feel security needed internal network enough. i realise means app open internal user malicious behaviour inside network outside of app user group so, raises issue when comes creating service in wcf. authentication without ssl appears quite fiddly. did manage find: [yaron naveh's clearusernamebinding][1] http://webservices20.blogspot.co.uk/2008/11/introducing-wcf-clearusernamebinding.html i felt solve problems until realised have alter plans offer restful service json, , have use soa

postgresql - Effective way to display the data in the chart -

i have application values stored in db, e.g. 1 value per second. 604800 values per 7 days , if want view value in graph need effective way how e.g. 800 values db if have chart 800px width. i use aggregation logic mean value computed values in 2, 3, 4, 5, 6, 10, 12 minute interval , hour , day interval aggregates computed. i use postgresql , aggregations computed statement: "insert aggre_table_ ... select sum(...)/count(*) ... timestamp > ... , timestamp < ..." is there better way how or what best way of data aggregation later displaying in charts? is better trigger or calling stored procedures? is there db support aggregations d3js, highcharts or google charts? how aggregate data large topic independent of technology choices. depends largely on how sensitive data is, important indicators of data are, implications of indicators are, etc. is single out of range point significant? or looking overall trend? these big questions answers aren'

html - jqgrid fluid last column to fit -

in jqgrid, can resize columns. initially when grid rendered, columns shrink fit , there no empty space @ right edge. when resize column horizontal scroll (when column width increased) or empty space (when column width decreased). want fill space everytime. i.e. last column should that. if column increased subtract pixels last column or if column decreased increase pixels last column. result there never horizontal scroll or empty space. resizestop: function(width, index) { initialwidth = this.p.colmodel[3].width; //***see below note line*** var finalwidth = math.abs(initialwidth - width); alert(finalwidth); } ***this gets me default width @ time of initialisation. need initial width i.e. before resizing. can maths it. fiddle - http://jsfiddle.net/audhx/597/ any appreciated. you need call setgridwidth inside of resizestop suggested in the answer . should try code updated part of answer if use 1 latest version of jqgrid. in case if code not need sh

cmd - Batch script that hides all items in folder -

i want create small .bat file hide items in 1 specific folder (actually add attributes +s , +h them), not @ scripting need help. thanks in advance. edit: don't want folder hidden, items inside it. this should job , hides folders also. attrib +s +h "c:\folder\*.*" /d

ios - Can I launch an app in Foreground when I enter an iBeacon range? -

i'm creating app ios using ibeacons. know, if set region monitor, framework can invoke app when enter/exit region, or turn on screen inside region. i've managed create local notification in callback well. question is, whether possible bring app foreground, if launched user? no, not believe possible. apple's philosophy user in control of app in foreground. 3 ways bring app foreground are: (1) tapping icon, (2) tapping notification associated app or (3) through custom url launch app different app. i have colleague has long insisted possible, tried myself today see sure. in our open source savengerhunt app , modified appdelegate's diddeterminestate method add code below try , force app foreground. nslog(@"attempting force window %@ foreground", self.window); [self.window makekeyandvisible]; nslog(@"done attempt"); the code executed when ibeacon detected in background, , log lines showed expected. app, how

php - uploading posted file to amazon s3 -

i'm trying upload file amazon s3 via laravel 4. after user submit form, file passed function need use amazon php sdk , upload file amazon s3 bucket. but how upload file straight away amazon s3 without saving file onto server. my current code looks this, private function uploadvideo($vid){ $file = $vid; $filename = $file->getclientoriginalname(); if (!class_exists('s3'))require_once('s3.php'); if (!defined('awsaccesskey')) define('awsaccesskey', '123123123'); if (!defined('awssecretkey')) define('awssecretkey', '123123123'); $s3 = new s3(awsaccesskey, awssecretkey); $s3->putbucket("mybucket", s3::acl_public_read); $s3->putobject($vid, "mybucket",$filename , s3::acl_public_read); } grab official sdk http://docs.aws.amazon.com/aws-sdk-php/latest/index.html this example uses http://docs.aws.amazon.com/aws-sdk-php/latest/class-aws.s3.