Posts

Showing posts from July, 2013

angularjs - IONIC: Changing colors dynamically on sidemenu demo -

i'm writing ionic framework "sidemenu" type of app (based on sidemenu demo/starter) allows user choose theme (basically, bars , buttons colors). problem when user clicks button change dynamically theme, changes color of menu's header , not color of views header (stays in first color of array). here codepen example (just click on "change color" button on side menu): http://codepen.io/anon/pen/oxqqqm note: variable $scope.temabar starts "ionic color positive" ( $scope.temabar = 'positive'; ) , changed when button "change color" clicked. can tell me i'm doing wrong? thanks well code pen not work can't tell wrong if want change classes dynamically use ng-class directive. simple, easy, fast, , works. if using ng-class please fix codepen , update answer :d https://docs.angularjs.org/api/ng/directive/ngclass and example: http://codepen.io/sevilayha/pen/onfrd html: <div class="container...

sql server - how to loop through table and set cell equal to an incremented value in sql -

Image
i have table of users , if companyid input equal companyid user name shown , other names shown xxxxx. need way set "name"(literally word name) , incremented number how ever many there are. select case when t1.companyid = @id t1.name else ( 'xxxxx' ) end name with input 148 shows i want show this, , on more names(name3, name4, etc..): with foo being name of table, works (see sqlfiddle ) : set @id = 142; set @i = 0; select companyid, case when foo.companyid = @id foo.name else (concat('name',@i := @i+1)) end name foo;

Drupal 7: Populate node fields with values from $form -

i know if it's possible populate node fields values form_state or that. basically show register form merged form content type. using field_attach_form(). on submit create node using: $node = new stdclass(); $node->type = 'company'; $node->uid = 1; node_object_prepare($node); and values form_state , put them node. many thanks! hook form, add new submit handler , place code there.

how to update com.android.application plugin? -

i'm getting message: plugin old, please update more recent version, or set android_daily_override environment variable "a9d6c794295e89d95704157e2ed8fd55ffd2765c" and: c:\path\mobile\build.gradle error:(1) problem occurred evaluating project ':mobile'. failed apply plugin [id 'com.android.application'] not create plugin of type 'appplugin'. top build.gradel file: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0-beta1' classpath 'com.google.gms:google-services:1.3.0-beta1' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } basically, don't know how update com.android.application plugin. apparently, beta releases of gradle android plugin expire. afaik, not documented behavior. right now...

android - new playlist created using ContentResolver doesnot show up in playlist -

i have created playlist using follwing code contentvalues cv = new contentvalues(); cv.put(mediastore.audio.playlists.name, "123456"); //uri uri = getcontentresolver().insert(mediastore.audio.playlists.getcontenturi("external"), cv); uri uri = getcontentresolver().insert(mediastore.audio.playlists.internal_content_uri, cv); if (uri != null) { toast.maketext(getapplicationcontext(),uri.tostring(), toast.length_long).show(); } each time run code details playlist created in content://media/internal/audio/playlists , id of playlist shown now activity used show playlists in phone public class playlist extends listactivity { //define source of mediastore.images.media, internal or external storage uri sourceuri = mediastore.audio.playlists.external_content_uri; //uri sourceuri = mediastore.audio.playlists.internal_content_uri; simplecursoradapter mysimplecursora...

ios - Access Gelocation from UIImage -

i can location information photo album on ios, access image location (latitude , longitude) when took photo. so image finished event public override void finishedpickingmedia(uiimagepickercontroller picker, nsdictionary info) { //uiimagepickercontroller.referenceurl var originalimage = new nsstring("uiimagepickercontrolleroriginalimage"); var image = (uiimage)info[originalimage]; foreach (var item in info) console.writeline(item.key + " " + item.value); image.savetophotosalbum(delegate(uiimage img, nserror err) { console.writeline("saved!"); }); _dp.dismissmodalviewcontroller(true); onimagechoosed(image); } } and in info dictionary, can see properties uiimagepickercontrollermediametadata { dpiheight = 72; dpiwidth = 72; orientation = 6; "{exif}" = { aperturevalue = "2.275007047...

javascript - Filtering view with AngularJS -

i have view whereby using ng-repeat populate couple of labels on screen. have search , using angular filter filter items in list. the issue when enter keyword in search bar, not search keyword in values binding in view, rather in whole json object being used render ng-repeat list. there way tell angular particular keyword in values bound view, rather json object? new angular, not sure if easy config or of sort.

c# - Unity 5 Windows phone 8 Game crashes on launch in wp8 device -

i have unity 5 project want build wp8. has 1 c# script. imports 1 custom package have created. package has default 5 dlls want app have mandatorily. have additional 10 dlls can referred choice. 1 can have minimum of 0 , max of 10 dlls referred in game. not mandatory use dlls. in case need additional functionality add them in project. now happens :: if custom package 5 dlls in project, build it, open vs soln , run it, crashes. exception trace :: {system.typeinitializationexception: type initializer 'winrtbridge.winrtbridge' threw exception. ---> system.typeinitializationexception: type initializer 'winrtbridge.typeinformation' threw exception. ---> system.io.filenotfoundexception: not load file or assembly 'windows, version=255.255.255.255, culture=neutral, publickeytoken=null' or 1 of dependencies. system cannot find file specified. @ unityengineinternal.bootstraphelpers.filltypemaps(dictionary 2& typetotypeidmap, list...

Which is the fastest way to remove MongoDB documents by Date? -

in our company have retention of 8 days of data (with 1 million of records aprox.) have cronjob remove documents older 8 days each day. we're using published field , this field not indexed . it takes 15 minutes finish rid off 100.000 records , found operation long. this query 'docs' variable array of documents don't want remove. 'thedate' variable date of 8 days ago. records.remove( { "published" : { $lte : thedate }, "_id" : { $nin : docs } } would better use _id field , indexed, in ordered operation? how can use _id field in order same operation? discard cron job entirely: job ttl indexes. http://docs.mongodb.org/manual/core/index-ttl/ create ttl index on published field expireafterseconds: 691200 , watch documents automatically removed 8 days after publication. and if don't want indiscriminately delete documents 8 days after publication, keep cron job , create plain index on published field.

c# - Validation of viewstate MAC failed ASP.NET -

i receiving error message below: validation of viewstate mac failed. if application hosted web farm or cluster, ensure configuration specifies same validationkey , validation algorithm. autogenerate cannot used in cluster. after lots of search, found document https://support.microsoft.com/en-us/kb/2915218 in above document found below section appendix a: how generate machinekey element in section, there function generate <machinekey> don't know put code in application , how call function. generate machine key using link <machinekey validationkey="56ab7132992003ee87f74ae4d9675d65eed8018d3528c0b8874905b51940deaf6b85f1d922d19ab8f69781b2326a2f978a064708822fd8c54ed74cadf8592e17" decryptionkey="a69d80b92a16dfe1698dfe86d4ced630fa56d7c1661c8d05744449889b88e8dc" validation="sha1" decryption="aes" /> the <machinekey> should put inside <system.web> section. follow link

javascript - remove array element if it doesn't exist -

i want remove element array ids if element doesn't exist . <div id="nl-form-0" > <input type="text" id='dynamic_translation_0_0' value="15" /> <input type="text" id='dynamic_translation_0_1' value="15" /> <input type="text" id='dynamic_translation_0_2' value="15" /> <input type="text" id='dynamic_translation_1_2' value="15" /> </div> ids = [ "transliteratetextarea", "dynamic_translation_0_0", "dynamic_translation_0_1", "dynamic_translation_0_2", "dynamic_translation_1_0", "dynamic_translation_1_1", "dynamic_translation_1_2"]; check_remove_ids_array(ids); console.log(ids); console.log($("#dynamic_translation_1_1").length); function check_remove_ids_array(array_in) { array_length = array_in.length; (n = 0; n ...

file - Java API for considering multiple physical drives as a single logical drive(clustered storage) -

we need store files in particular directory on windows machine(say c:/datalocation ). due huge number of files, c drive gets filled eventually. need location in drive, let d:/anotherstore . initially can use following code access store location. file store = new file("c:/datalocation"); but later when add drive, there way consider new location logical part of first location? something below code. store.addanotherlocation("c:/anotherstore"); here store should able retrieve data both locations. there no java api, can catch "not enough disk space" exception ioexception , handle making code save files in other location. , while retrieving files, in both locations if requested file exists. ok, if want randomly save in 2 locations, save file in both locations based on (int)(math.random()*2); . if 0 , save in c:/datalocation else in d:/otherstore

How to disable Hiera debug output in rspec-puppet test -

i have following spec file require 'spec_helper' describe 'plc', :type => 'class' let(:hiera_config) { 'spec/fixtures/hiera/hiera.yaml' } hiera = hiera.new({ :config => 'spec/fixtures/hiera/hiera.yaml' }) abc = hiera.lookup('plc::plc_line',nil,nil) let(:hiera_data) {{ :plc_line => abc }} it{ should contain_file('/test/rspec/etc/plc').with( 'ensure' => 'file', 'owner' => 'root', 'group' => 'root', 'mode' => '0644', 'require' => 'file[/test/rspec/etc]') } it{ should contain_file('/test/rspec/etc/plc').with_plc_line(abc)} end below /hiera/fixtures/plc.yaml plc : puppetlab when run rake spec , following messages printed: debug: wed jul 08 07:11:55 -0400 2015: hiera yaml backend starting debug: wed jul 08 07:11:55 -0400 2015: looking plc::...

Internal Server Error 500 mkdir(): Permission denied apache php -

apache gives permission error php on centos linux remote server. i read , tried no luck. i tried disabling selinux setenforce 0; i tried permissions 777 , chown -r apache:apache var/www chown -r root:apache var/ww also: chcon -r -t httpd_sys_content_t /var/www chcon -r -t httpd_sys_content_rw_t /var/www/http/f3 error_log says : /var/www/html/f3/lib/errorhandler.php on line 26 [wed jul 08 14:06:51.744772 2015] [:error] [pid 29288] [client 127.0.0.1:37240] mkdir(): permission denied [wed jul 08 14:06:51.745084 2015] [:error] [pid 29288] [client 127.0.0.1:37240] [f3/lib/base.php:2015] base->error(500,'mkdir(): permission denied') [wed jul 08 14:06:51.745124 2015] [:error] [pid 29288] [client 127.0.0.1:37240] [f3/lib/base.php:2407] mkdir('/f3/tmp/f3filescache/',493,true) [wed jul 08 14:06:51.745134 2015] [:error] [pid 29288] [client 127.0.0.1:37240] [f3/lib/base.php:340] cache->load('folder=/f3/tmp/f3filescache/',true) [wed jul 08 14:06:51.7451...

mysql - How do I retrieve data for the previous month in SQL -

i want data dates between 2015-05-01 , 2015-06-01 using sql. please me query. the query used is: select *,count(id) multiple_visitors table1 id=123 , (date(server_time) between (curdate() - interval 31 day) , curdate()) group user_id having count(id)>1 you can month() , year() : where month(server_time) = month(curdate() - interval 1 month) , year(server_time) = year(curdate() - interval 1 month) however, recommend more complex expression: where server_time >= date_sub(date_sub(curdate(), interval - day(curdate()) + 1 day), interval 1 month) , server_time < date_sub(curdate(), interval - day(curdate()) + 1 day) the advantage there no functions on server_time , database engine can use index, if appropriate. as note: expression date_sub(curdate(), interval - day(curdate()) + 1 day) gets midnight on first day of month.

Display Query Result Parse.com android -

i have question, might sound silly question, don't know how , need answer. in parse.com after finishing query, how can display result for example parsequery<parseobject> gamequery = parsequery.getquery("game"); gamequery.whereequalto("createdby", parseuser.getcurrentuser()); i want set result of query text view in app: textview.settext(??) ; thank in advance :) edit: and code i'm using public class adapter extends parsequeryadapter<parseobject> { //mediaplayer mediaplayer; public adapter(context context) { super(context, new parsequeryadapter.queryfactory<parseobject>() { public parsequery create() { parsequery query = new parsequery("game"); return query; } }); } // customize layout overriding getitemview @override public view getitemview(final parseobject object, view v, viewgroup parent) { if (v == null) { v = view.inflate(getcontext(), r.layout...

how to find the error, Program crash after executing quit sequence (Python, opencv, Ubuntu) -

i'm trying run program has been running before. after while switched os , came ubuntu 14.10 (before 14.04). i'm not quite shure if problem within opencv or more of basic thing. can't find problem. maybe of has idea. import cv2 cap = cv2.videocapture(0) while(true): # capture frame-by-frame ret, frame = cap.read() # display resulting frame cv2.imshow('frame',frame) if cv2.waitkey(1) & 0xff == ord('q'): break # when done, release capture cap.release() cv2.destroyallwindows() it running point can see video capture. typing "q" quit program. window opened freez, turning black after while , nothing else happens. i'l have close window , force exit. idea problem , how solve? some buffers perhaps used drawing , releasing memory bad idea. so try call destroyallwindows, before calling cap.release ?

ibm bluemix - Can I change owner of directory that is mounted on volume in IBM containers? -

i'm trying launch postgres in ibm containers. have created volume by: $ cf ic volume create pgdata then mount it: $ cf ic run --volume pgdata:/var/pgsql -p 22 registry.ng.bluemix.net/ruimo/pgsql944-cli after logging container through ssh, found mounted directory owned root: drwxr-xr-x 3 root root 4096 jul 8 08:20 pgsql since postgres not permit run root, want change owner of directory. cannot change owner of directory: # chown postgres:postgres pgsql chown: changing ownership of 'pgsql': permission denied is possible change owner of mounted directory? in ibm containers, user namespace enabled docker engine. when, user namespace enabled, effective root inside container non-root user out side container process , nfs not allowing mapped non-root user perform chown operation on volume inside container. please note volume pgdata nfs, can verified executing mount -t nfs4 container. you can try workaround suggested how can fix permissions using...

android - Threshold image using opencv (Java) -

Image
i working opencv project. need convert image below threshold image i tried function: imgproc.threshold(imggray, imgthreshold, 0, 255, imgproc.thresh_binary + imgproc.thresh_otsu); but result not good, see below so tried adaptivethreshold function : imgproc.adaptivethreshold(imggray, imgthreshold, 255, imgproc.adaptive_thresh_gaussian_c, imgproc.thresh_binary, 11, 2); and resulted: i expect binary image white background , black text only, no black area or noise ( not prefer using photo.fastnlmeansdenoising because takes lot of time). please me solution this. also, using tesseract japanese recognization accuracy rate not good. have suggestion on better ocr japanese, or method improve tesseract quality? adaptivethreshold right choice here. just need litte tuning . these parameters (it's c++, can translate java) mat1b gray= imread("path_to_image", imread_grayscale); mat1b result; adaptivethreshold(gray, result, 255, adaptive_thresh_me...

Sorting object in javascript -

this question has answer here: sorting object sub-object property 3 answers i have object has object value. want sort object based on 'copy' key value. fiddle var x= {'one':{'copy':'b'},'two':{'copy':'v'},'three':{'copy':'a'}} var getsort= [] for(i in x){ var a= new object(); a[i]=x[i] getsort.push(a) } getsort.sort(function(a,b){ //console.log(b) //console.log(a.copy) var texta = a.copy.touppercase(); var textb = b.copy.touppercase(); return (texta < textb) ? -1 : (texta > textb) ? 1 : 0; }) console.log(getsort) this work you: var x= {'one':{'copy':'b'},'two':{'copy':'v'},'three':{'copy':'a'}} var getsort= [] for(i in x){ if (i != undefined) { //co...

javascript - Do nothing on empty input - combinate with dynamic action on form -

what want when type in input , depending button click, change path of action in form . @ half way achieve (i think)....check out make till now function onsubmitform() { if(document.pressed == 'log as') { document.myform.action ="log-as.html"; } else if(document.pressed == 'log int') { document.myform.action ="log-as-int.html"; } return true; }; <form name="account" onsubmit="return onsubmitform();"> <input type="text" name="user" id="user"> <input type="submit" name="account" onclick="document.pressed=this.value" value="log as" /> <input type="submit" name="account" onclick="document.pressed=this.value" value="log int" /> </form> and maybe found solution this, don't know how combina...

angularjs - How to call java method using Angular JS? -

i using angular js spring mvc project. want call java method directly html using angular js populate drop down. thanks. you can't because angular js working on client side while java running on server. need rest interface accepts invocations angular js app. rest interface (most likely) written in java on server side, can make desired java call drop down values , send them response part of rest call. use angular js interpret , use response server. sorry not being more precise should give pretty starting point.

skew - Rapidminer for finding statistics -

i beginner in rapidminer . while working on rapidminer i didn't find how calculate or skewness , kurtosis of attributes in exampleset. i know there way best fit line scatter plot graph for skewness , kurtosis, either calculate using combination of operators or use r extension , use moments package contains these functions. think use r. for scatter plot question, use linear regression operator build model fits straight line. need arrange 1 of attributes label predicted other attribute.

ios - Using an array technique for manipulating individual pixels on screen -

a programmer told me used array technique manipulating individual pixels on screen attain specific in (java?) game. outcome: http://awkwardknight.com/staygame/gifs/day-night_cycle3.gif that exact same thing trying get: 'lightsource' (or general area) nullifies tinted layer around make seem light illuminating vicinity. programmers exact words: "the way caelis renders uses pixel array representing each pixel on screen , using function, can iterate , darken/lighten whatever want." i can't understand how this. i've never done this. right have 'skshapenode' serving tint layer alpha varying on time of day (which 'nsdate'). can't change individual pixel alphas. can please explain how write such function? maybe example code? appreciated since don't know how write custom shader either u_u manipulating every single pixel (or point) on screen sounds extremely inefficient way of doing things. to achieve day/night effect in anim...

android - Query multiple keys in couchbase lite view -

hi new couchbase/couchbase-lite , try query view multiple keys without success. how map function looks: public void map(map<string, object> doc, emitter emitter) { if (doc.get("type").equals("my_type") { list<object> keys = new arraylist<object>(); keys.add(doc.get("key_1")); keys.add(doc.get("key_2")); emitter.emit(keys, null); } } my problem need query view either key_1 or combination of key_1 , key_2 list<object> keys = new arraylist<object>(); keys.add(key_1); if (key_2 != null) keys.add(key_2); query.setkeys(keys); results = query.run() however results empty. overlook anything? two emits doesn't work. if give arraylist in setkeys() method, each key in list match each key in emit. if want match 2 keys, add keys arraylist list. pass setkeys() method. this, list<object> keys = new arraylist<object>(); list<object> allkeys = new...

php - i am getting null value from a function in model -

i using codeigniter. need select employee detail using employee id , store selected detail in table. have function in controller file given below public function delete() { //product id $id = $this->uri->segment(4); $data_to_store = $this->employee_model->get_employees_by_id($id); $data = array('id'=> $data_to_store['id'], 'emp_first_name' => $data_to_store['emp_first_name'], 'emp_last_name' => $data_to_store['emp_last_name'], 'emp_email_id' => $data_to_store['emp_email_id'], 'emp_emergency_contact' => $data_to_store['emp_emergency_contact'], 'category' => $data_to_store['category'], 'emp_id_card' => $data_to_store['emp_id_card'], 'emp_time_in' => ...

ios - '_ ??' is not convertible to '()' with NSMutableAttributedString -

i've i'm pretty new swift , i'm stuck in setting nsmutableattributedstring in uilabel . var attributedstring = nsmutableattributedstring("random string example") attributedstring.addattribute(nsforegroundcolorattributename, value: uicolor.redcolor(), range: nsmakerange(1, 3)) tweettextlabel?.text = attributedstring the last line gives me: '_ ??' not convertible '()' can't compile. i tried with: tweettextlabel?.text = attributedstring.string but in way lose color attribute you should set attributedtext property of uilabel , like: tweettextlabel?.attributedtext = attributedstring

android - how to convert my java object to json and save it in sd card -

i don't know how after convert java json jackson protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); objectmapper mapper = new objectmapper(); book b = new book(); arraylist<book> listbook = new arraylist<book>(); listbook.add(b); b = new book(); b.setname("exam"); b.setfilename("res/raw/exam.txt"); b.setcate(0); //4 categories here b.setsoundfilename("res/raw/exams.mp3"); b.settranfilename("res/raw/examt.txt"); listbook.add(b); b = new book(); b.setname("test"); b.setcate(0); b.setfilename("res/raw/test.txt"); b.setsoundfilename("res/raw/tests.mp3") b.settranfilename("res/raw/textt.txt"); string jsonstring = ""; try { jsonstring = mapper.writevalueasstring(listbook); } catch (jsongenerationexception ...

python - How do I launch my server and client programs together? -

typically run 3 python files. i.e. manually run: runserver.py wait while run, white.py black.py the game not start unless run 3 files. files not run successively.i.e. runserver.py not run terminate , white.py start run. it's suppose run concurrently. i wish automate process such when run runserver.py, automatically run both white.py , black.py , game can proceed. currently code runserver.py, doesn't work however, code launches board doesn't seem launch white.py or black.py: board = board.board() white = server.server(1) black = server.server(2) board.playgame(white, black) execfile("white.py") execfile("black.py") any appreciated. thanks! presumably board.playgame never returns, execution never reaches execfile . use matteo's solution or @ launching board subprocess

eclipse - Installing Android SDK Platform tools 23 rc3 automatically uninstalling Android SDK Platform tools 22 -

i have switched android studio eclipse . have seen when installing android sdk platform tools 23 rc3 automatically uninstalling android sdk platform tools 22 , and have seen when start sdk manager eclipse showing version of android api , when start sdk manager android studio doesn't show me android api version - 2.0, 3.x, 4.0 . what can reason this? you can have 1 platform tools @ once if install android sdk platform tools 23 rc3 replace android sdk platform tools 22 . if want have multiple platform tools have use multiple separate sdk folders. if want see old android api versions in android studio sdk manager can tick obsolete checkbox inside sdk manager , appear.

java - How can I parse job definition kind of file -

assume have kind of file schedule aep#gsae3_sco_d99008 timezone ect description "apollo_ mqft sending jobs" on runcycle rule1 "freq=daily;" : aep#gsae3_sco_d99008_asup_ord_v4 scriptname "-job z3_sco_d99008_asup_ord_v4 -user beckdel1 -i 04093800 -c c" streamlogon batchatl description "take customer order send in mqft format" tasktype sap recovery stop @ 2145 timezone ect needs 1 aep#gsae_sco ... end this file tws (tivoli workload scheduler). want json or xml file looks like: { "jobstream":"aep#gsae3_sco_d99008", "timezone": "ect", "description": "apollo_ mqft sending jobs", "jobs": {[ "job": "aep#gsae3_sco_d99008_asup_ord_v4", "sap_job": "z3_sco_d99008_asup_ord_v4", "sap_user": "beckdel1", "id": 04093800, "streamlogon": "batchatl", "description...

java - Google Spreadsheet with a service account -

Image
i want access spreadsheet on google drive using de java google spreadsheet api. in past used client login method login method deprecated now. i'm trying use service account getting authenticated without interaction user because tool running in background needs automated. can't working. these code now. list<string> scopes_array = arrays.aslist( "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://docs.google.com/feeds", "https://spreadsheets.google.com/feeds"); credential = new googlecredential.builder() .settransport(transport) .setjsonfactory(jsonfactory) .setserviceaccountid( "xxxxxx@developer.gserviceaccount.com") .setserviceaccountscopes(scopes_arr...

javascript - Access this from callback inside member function -

this question has answer here: how access correct `this` inside callback? 5 answers i'm trying access class instance callback within member function. 1 example how like: myclass.prototype.foo = function(){ var arr = [1, 2, 3]; arr.foreach(function(element){ //the next line doesn't work //becuase doesn't reference myclass-instance anymore this.elements.push(element); }); } here of course work loop ( for(var = 0; < arr.length; i++) {...} ) there situations can't. i found 1 way access myclass instance: myclass.prototype.foo = function(){ var arr = [1, 2, 3]; var mycurrentinstance = this; //store temporary reference arr.foreach(function(element){ //here works because use temporary reference mycurrentinstance.elements.push(element); }); } this doesn't seem clean me. th...

token - class.phpmailer.php not in a defined site error -

even though had saved phpmailer_5.2.4 file inside codeigniter_2.2.0 , showing class.phpmailer.php not there in local disk. , have confirmed class.phpmailer.php there in phpmailer_5.2.4 . my code follows: <?php if ( ! defined('basepath')) exit('no direct script access allowed'); require('phpmailer_5.2.4/class.phpmailer.php'); class site extends ci_controller { public function __construct(){ parent::__construct(); $this->load->model('site_model'); //$this->load->helper('url'); } public function index(){ $this->load->view('welcome'); } public function view(){ $this->load->view('registration'); } public function generate_token ($len){ // array of potential characters, shuffled. $chars = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i...

c# - How to order IGrouping without changing its type? -

i have oject of type igrouping , order elements inside group without changing type of object. in other words, have var tmp = group.orderby(x => x); with group being of type igrouping<int, someanonymousclass> , want tmp of type igrouping<int, someanonymousclass> well. one workaround change dictionary or new anonymous class, want tmp specificly of type igrouping<int, someanonymousclass> . in other words: want sort elemnts of igrouping<int, someanonymousclass> object. if use orderby changes type of group iorderedenumerable , cannot access group.key anymore. how can sustain type of group ? example: var states = simulationpanel.innerpanel.children.oftype<statebar>().where(x => x.issensorstate()) .groupby(x => (sensorelement)x.bauplanelement, x => new { start = (decimal)(x.margin.left / simulationpanel.zoom), ...

internet explorer - sortable.js ( No jQuery ) doesn't work in IE with touch screen -

i using library sorting items: http://rubaxa.github.io/sortable/ in chrome everything's fine, in ie 11 dragging not working when use touch screen of pc. i guess problem in pointer events ie 11. has found solution problem? it's more workaround solution maybe try http://touchpunch.furf.com/ it helps me make fullcalendar touchable mabye works sortable too.

python - Cassandra: 'unicode' does not have the buffer interface -

i try use these both prepared statements in django app: readings = "select * readings" readings_by_user_id = "select * readings user_id=?" i query against db with: def get_all(self): query = self.session.prepare(ps.all_readings) all_readings = self.session.execute(query) return all_readings def get_all_by_user_id(self, user_id): query = self.session.prepare(ps.readings_by_user_id) readings = self.session.execute(query, [user_id]) return readings the first of both works pretty well. second gives me: error 2015-07-08 09:42:56,634 | views::exception_handler 47 | ('unable complete operation against hosts', {<host: localhost data1>: typeerror("'unicode' not have buffer interface",)}) can tell me happened here? understand, there must unicode string somewhere not have buffer interface. string meant? prepared statement? here stacktrace in addition: traceback (most recent call last): file ...

javascript - Replace string in a element with vanilla JS -

im using jquery script replace text in element. need plain javascript. how do that? this script i'm using: $('document').ready(function(){ $( ".tp-caption.black:contains('.000000')" ).text('.1111111'); }); using small polyfill this: function hasclass(element, cls) { return (' ' + element.classname + ' ').indexof(' ' + cls + ' ') > -1; } you can like: // elements. var elements = document.getelementsbyclassname("tp-caption"); // iterate each. (var = 0; < elements.length; i++) { // check if text found. if (elements[i].innerhtml.indexof(".000000") != -1 && hasclass(elements[i], "black")) // replace contents. elements[i].innerhtml = '.1111111'; } this replaces whole string. if wanna replace part, use this: // elements. var elements = document.getelementsbyclassname("tp-caption"); // iterate each. (var...

arrays - Matlab : Reading strings and numbers to workspace -

so excel file test.xlsx have 1.44e+12 33 nochange 1.44e+12 4 1.44e+12 466 nochange 1.44e+12 have 1.44e+12 467 nochange 1.44e+12 4 1.44e+12 100 nochange 1.44e+12 minutes 1.44e+12 666 nochange 1.44e+12 i used eyet = xlsread(test.xlsx) , im getting numbers right, nan string values. there other function read it? textscan maybe? use 3 outputs of xlsread . here's example: excel file: have 1 aa 5 4 2 bb 6 have 3 bb 67 matlab code: >> [num, txt, raw] = xlsread('test.xls') num = 1 nan 5 2 nan 6 3 nan 67 txt = 'have' '' 'aa' 'four' '' 'bb' 'have' '' 'bb' raw = 'have' [ 1] 'aa' [ 5] 'four' [ 2] 'bb' [ 6] 'have' [ 3] 'bb' [ 67] [ nan] [nan] [nan] [nan]...

performance - XPages Valuebinding Fails following update -

Image
i have particularly troublesome xpages application complete re-write is, has been developed , (partially) improved on last few years in effort try , keep running smoothly. it's getting slower , slower made 2 changes last night, , morning noticing lot of jvm errors on console. removed jquery repeat control tables displaying view data , replaced them viewpanels instead; these quicker @ loading , rendering view lots of documents in it. changed page persistence "keep on disk" "keep current page in memory" - hoping speed things up. today seeing lots of errors like: http jvm: unable open database: com.ibm.xsp.binding.javascript.javascriptvaluebinding@3b2c3b2c. more detailed the main database supported archive db old records, load in ui of main db pointing data path archive. there db contains lots of small supporting documents referenced main front end ui db. there links other dbs, work me , numerous other users. need track down causing error above peopl...

android - Overwrite country price for an existing in-app product in Google play -

we have existing in-app product defined our android application on google play. i want overwrite price countries,but following message shown in in-app product's page in play's developer console: "please note can not change price , billing period subscription after activated." what can change price? have create new in-app product? isn't there easy way change price whenever want developer console activated products?

java - Best way to retrieve logged user in app -

i want retrieve current logged user in many places in android app. best way? save in static variable in user class , retrieve user.getcurrentuser() get dao or repository usersrepository.getcurrentuser() or there better way? thanks. in web application use standard way: request.getremoteuser() if need have additional information user store in session: session.setattribute("user", userobject); if using kind of application (for example mobile application) , 1 user per time can logged can use singleton store information of user: user user = user.getinstance(); user.setname("blabla"); // store information user.getname(); // information

javascript - change src from script which depend on the browser size -

i got little bit problem website i'm trying change src attribute script based on browser size script inside of div here how code looks like <div style="margin: 15px 0px 0px; display: inline-block; text-align: center;"> <script id="world" type="text/javascript" src="http://localtimes.info/world_clock2.php?&cp1_hex=ffd700&cp2_hex=000000&cp3_hex=000000&fwdt=72&ham=0&hbg=0&hfg=0&sid=0&mon=0&wek=0&wkf=0&sep=0&widget_number=21000&lcid=snxx0006,usny0996,ukxx0085,asxx0112,hkxx0001"></script> </div> i'm trying change src script src contain width (fwdt value in script) of widget want change based on browser size i'm trying solve problem following code <script> var w = window.innerwidth; if (w>991) { document.getelementbyid("demo").innerhtml = "width: " + w ; $('#world').attr('src...

php - Redirect from one path to another using htaccess -

redirect 1 path using htaccess i have urls these:- https://www.example.com/au/path1 https://www.example.com/sg/path1 https://www.example.com/ca/path1 and many more, want redirect these url type :- https://www.example.com/au/path2 https://www.example.com/sg/path2 https://www.example.com/ca/path2 but not getting desired result, here code :- rewriteengine on rewritecond %{request_uri} path1 rewriterule ^(.*)$ %{request_uri}/path2 [r=301,l] another solution redirect these urls 1 one redirect directive of apache mod_alias . try in root/.htaccess file : redirectpermanent /au/path1 /au/path2 redirectpermanent /sg/path1 /sg/path2 redirectpermanent /ca/path1 /ca/path2 you can change redirectpermanent redirecttemp temporary redirect.

javascript - Exploiting jQuery HTML decoding using textarea -

following on my last question ... this code can exploited if attacker has access encodedtext : return $('<div/>').html(encodedtext).text(); e.g. $("<div/>").html('<img src="x" onerror="alert(\'hi\');" />').text() displays alert. this answer recommends using textarea instead avoid xss vulnerability: return $('<textarea/>').html(encodedtext).text(); this able handle previous exploit safely. however, this answer indicates there still xss vulnerabilities when using textarea : i suggest using safer, more optimized function don't use jquery.html().text() decode html entities it's unsafe because user input should never have access dom my question is: there way in browser exploit $('<textarea/>').html(encodedtext); run xss assuming attacker has access encodedtext ? i wouldn't risk honest, lot safer if handled needed encrypted or unencry...

c# 4.0 - Will windows refresh launch an application much faster? -

i have c# console application takes lot of time of launch. when open task manager , press f5 in parallel, application launching faster is. what technical reason behind ? if so, can implement refresh logic in code (in parallel main thread). know sounds strange, trial , error. edited : console applicaton loads lot of assmeblies using reflection (more 400). please provide inputs.

bash - Unix /Linux - several applications using the same environment variables but different values? -

i looking advice on following below: i have several applications , tools on server requires environment set variables etc them run. many of these applications use same environment variables run different values. some of these applications have multiple versions. e.g. prog v1.1 , prog v1.2 , prog v1.3 etc.. example: prog v1.1 uses environment variable var1 = val1 , prog v1.2 needs var1 = val2 in order run. same variable, different values required each application. another example is: prog3 require number of environment variables set prog4 doesn't need. there logic involved when setting environment these applications, if file exists; this; else that i've created shell scripts e.g. prog1setup.sh , prog2setup.sh etc setup environment each of these applications , then: start new shell every application needs run, run shell script , run application inherits environment variables what i'd know is, there open source tools avail...