Posts

Showing posts from September, 2015

c++ - Move semantics and virtual methods -

in c++11 guided in cases pass objects value , in others const-reference. however, guideline depends on implementation of method, not on interface , intended usage clients. when write interface, not know how implemented. there rule of thumb writing method signatures? example - in following code fragment, should use bar1 or bar2 ? class ifoo { public: virtual void bar1(std::string s) = 0; virtual void bar2(const std::string& s) = 0; }; you can stop reading here if agree correct signature depends on implementation. here example shows why believe so. in following example, should pass string value: class foo { std::string bar; foo(std::string byvalue) : bar(std::move(byvalue)) { } }; now can instantiate foo in efficient manner in cases: foo foo1("hello world"); // create once, move once foo foo2(s); // programmer wants copy s. 1 copy , 1 move foo foo3(std::move(t)); // programmer not need t anymore. no copy @ in other case

java - Why is my servlet session not persistent? -

my servlet working expected other when close browser (i not deleting cookies), session lost. how can save session indefinitely until invalidate or delete cookies? @webservlet(name="servletone", urlpatterns={"/", "/servletone"}) public class servletone extends httpservlet { private static final long serialversionuid = 1l; public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { httpsession session = request.getsession(true); string newvalue = request.getparameter("newvalue"); if (session.isnew()) { session = request.getsession(true); session.setattribute("myattribute", "value"); } if (newvalue != null) session.setattribute("myattribute", newvalue); requestdispatcher rd = request.getrequestdispatcher("test.jsp"); rd.forward(requ

jquery - cakephp 2x + ajax pagination + prototype js -

i want create add/edit/delete , active/deactive (with ajax) in listing page. here have uploaded demo http://mehul.pw/cp/categories/index right pagination working fine. when change status , use pagination not working. trying solve 3hr here have mentioned below code controller code below: public $helpers = array('js' => array('prototype')); public $components = array(); public function beforefilter() { parent::beforefilter(); } public $paginate = array( 'limit' => 1, 'order' => array( 'category.category_id' => 'asc' ) ); public function index() { $data = $this->paginate('category'); $this->set('categories',$data); } public function update($field,$value,$id = null,$pageno,$sortkey,$sortdir) { if (!$id) { $this->session->setflash(__('invalid id event', tru

android - PhoneGap - target-densitydpi on viewport -

Image
i'm creating app android , ios using phonegap. after creating "helloworld" app phonegap's template see target-densitydpi=device-dpi on viewport default . okay, that's fine decided run tests jquery mobile ui , do not use target-densitydpi on viewport (by way if do, website should small on high dpi devices). since need images of app great @ low , high resolution devices, decided run tests on galaxy s4. first, target-densitydpi=device-dpi removed : <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" /> the document.width 360px, created 360px image , blurry @ gs4 screen. <img src="360img.jpg" style="width:360px;"> second, target-densitydpi=device-dpi enabled : <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=d

active directory - PowerShell Clear-ADAccountExpiration not performing in the same way as the manual method -

Image
i have issue when using powershell clear-adaccountexpiration reset account expiration date never in active directory. here's account going expire: get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : 31/12/2013 17:00:00 accountexpires : 130330692000000000 as can see expire on 31/12/2013 17:00:00 . want clear expiration , set never expire; use following cmdlet : clear-adaccountexpiration osbor_ri this clears accountexpirationdate varible in ad doesn't clear accountexpires 0 instead it's set 9223372036854775807 each time. get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : accountexpires : 9223372036854775807 but when use manual method in ad set account never expire accountexpires varible set 0 . get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : accountexp

java - OnLong Click ListView Pop-UP -

Image
i implement in listview longclick, there succeeded :) create sort of pop-up more possibilities, example, paste, delete, remove, etc ... make understand found picture on internet :) ve mail below. thank in advance try use pop menu this.. public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button button = (button) findviewbyid(r.id.button2); registerforcontextmenu(button); } @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); getmenuinflater().inflate(r.menu.main, menu); } public void showpopup(view v) { popupmenu popup = new popupmenu(this, v); getmenuinflater().inflate(r.menu.main, popup.getmenu()); popup.show(); popup.setonmenuitemclicklistener(new onmenuitemclicklistener() { @override

jquery - ajax call not reset old data -

i using ajax in website, working fine not success data on next call, mean if on first call, data 1 , 0 , on second call data 0 , 1, showing on 2nd call 1, 0, 0, 1 function checkform(){ var userid = $("#userid").val(); var email = $("#email").val(); $.ajax({ url:path+"ajax_getpass.php", data:{userid : userid, email : email}, cache:'false', type:'post', datatype:"json", success: function(data_send){ $(document).ajaxcomplete(function(event, request) { //data = $.parsejson(data); alert(data_send.email); alert(data_send.userid); }); } }); return false; } please tell me wrong. this because add more , more functions ajaxcomplete() every time ajax request successful. when success code called first time, 1 function called ajaxcomplete() . next request, function added, 2 functions called. use code instead: $.ajax({ url:path+"ajax_g

css - MVC data-val-required on element besides input (Html.EditorFor) -

in mvc, when create model property "required" , in html markup create editorfor (input box) property auto-magically adds "data-val-required" css property , can style input box please. assuming have heading before input box, how detect if editor associated , next required field, can style heading (make red or add asterisk in front of it) instead of input? <td>heading want style</td> <td>@html.editorfor(model => model.requiredfield)</td> you can achieve follows: in model set displayname attribute property follows: public class modelname { [required] [displayname("label text")] public string propertyname { get; set; } } then in view can add class editor label follows: <td>@html.labelfor(model => model.propertyname , new { @class= "classname" })</td> <td>@html.editorfor(model => model.propertyname )</td> the above label render follows: <label for=&q

objective c - Pass button Selected state to another view Controller -

i have 2 view controllers. 1st controller have 1 button. use button.selected = yes; i'm using if statement custom functions if button selected state. -(ibaction)play:(id)sender; { if (button.selected) { custom code } } when use button in same view controller play button works. want move button view controller. it's not working. question how pass button select value other view controller? i don't know you're trying achieve. dragged button 1 interface builder window , wonder why button doesn't trigger 'play:' in vc 2 or want let second view controller know state of button subview of view controller one? 1) if dragged button 1 ib window check connections again. that's usual problem here. 2) if wanna let vc 2 know state of button that's currenty on vc 1 one way adding bool vc 2 represents button's state. whenever button get's triggered responsible updating bool.

(SOLVED) Using Regex in Java based on working php code -

i've been using in php... preg_match_all('|<a href="http://www.mysite.com/photoid/(.*?)"><img src="(.*?)" alt="(.*?)" /></a>|is',$xx, $matches, preg_set_order); where $xx entire webpage content string, find occurrences of matches. this sets $matches 2 dimensional array can loop through statement based on length of $matches , use example .. $matches[$i][1] first (.*?) $matches[$i][2] second (.*?) and on.... my question how can replicated in java? i've been reading tutorials , blogs on java regex , have been using pattern , matcher can't seem figure out. also, matcher never finds anything. while(matcher.find()) have been futile , throws error saying no matches have been found yet this java code pattern matched ... string pattern = new string( "<a href=\"http://www.mysite.com/photoid/(w+)\"><img src=\"(w+)\" alt=\"(w+)\" /></a>

html - Pasted text at the top of page -

Image
i want add pasted text (that text goes down when user goes down of page, etc.) @ top of page, when haven't got enabled javascript, : how ? there way using javascript or html ? want not use jquery, because don't know language good. @edit : sorry, error - cannot use javascript if user doesn't have js enabled :) this sample how can make info bar so: html: <noscript><div id="noscript"><p>no javascript</p></div></noscript> css: div#noscript { margin: 0 auto; width: 100%; padding: 10px 0; position: fixed; top: 0; background: red; z-index: 99999; } div#noscript p { text-align: center; color: white; } here jsfiddle

Google CardDAV API Authentication -

is there way authenticate accounts' contacts saved token? in research looks have create new token having user login , give consent. thank you, brandon yes, there is. make sure include access_type=offline in authentication request. after user gives app permission first time refresh token present in response. if save it, can use later new access token every time need it. no consent screen shown. although can craft own auth mechanism, google provides nice set of client libraries , work (exchanging refresh token access token, getting new refresh token after has expired, ...).

Turn off notifications for Meteor collections -

how tell meteor stop publishing changes on collection (for moment)? how tell resume , collection changed? basically (on server): people = new meteor.collection("people") insertpeople = -> // don't notify clients of following changes // insert bunch of people people collection // resume notifications put flag in each document, 'updating'. add new ones set true; render template css class hides them based on field. when ready, update collection updating: false. visible pretty quickly. this being said, there events can plug make transitions more pleasant/animated. didn't think asking that, may better answer. to comment: inserting template additional document triggers dom changes, expensive, , device has figure out how display. updating property requires second part, device has figure out how display.

git - Why doesn't a bare repository have refs/heads/master? -

i've got bare repository, , doesn't have entry in refs/heads master . storing ref? you should find refs you're looking in packed-refs file. see git-pack-refs(1) documentation more. specifically: when ref missing traditional $git_dir/refs directory hierarchy, looked in file , used if found.

python - Making a tkinter scrollbar wider -

Image
i'm coding in python 2.7/tkinter in windows , putting scrollbar on listbar, can enough (thanks effbot.org ). however, want make scrollbar wider - used on touchscreen easier select it, better. figured width attribute make wider, create blank space. doing wrong here? code: from tkinter import * top = tk() scrollbar = scrollbar(top, width=100) scrollbar.pack(side=right, fill=y) listbox = listbox(top, yscrollcommand=scrollbar.set) in range(1000): listbox.insert(end, str(i)) listbox.pack(side=left, fill=both) scrollbar.config(command=listbox.yview) top.mainloop() yields this: for scrollbar.pack(side=right, fill=y) fill=both instead of fill=y .

javascript - Link to bootstrap section id from button (not navbar) -

i have bootstrap html page , don't know how link section of page button. my page has navbar, has normal in it. links work fine , scroll down page correct section. if create button further down page like: <div class="span4"> <a class="btn btn-large btn-block btn-danger" href="#pricing">see plans , pricing</a> </div> the button not scroll part of page. nothing. any suggestions? edit 1 posting html here: http://pastebin.com/m9y6nuei imho, pricing button works well, after cleaning messy code (missing closing tags, empty attributes...). here working code: http://jsfiddle.net/s4lte/ <div class="span4"> <a class="btn btn-large btn-block btn-danger" href="#pricing">see plans , pricing</a> </div> … <section class="" id="pricing" data-spy="pricing" data-target="#pricing

windows - Find all devices on network -

i have switch requires configuration file transferred via tftp before switch operate correctly. network operates on 10.x.x.x ip scheme, switch comes factory 192.168.1.x ip address. there headless embedded system in charge of network management change ip address of switch it's proper 10.x.x.x address, transfer configuration file switch. issues is, don't know how find mac address of new switch. basically, scenario follows. switch in network ceases operate. maintenance worker swap out switch. network management system notified scan network new devices. when switch's mac address found, ip address changed, ip based communications can commence transfer configuration file. i'm working in c++ on project. code snippets cool, if tell me process finding mac address indescribably grateful. thanks! edit: os windows embedded 7 standard

java - Can changes in the order of the method parameters be called method overloading? -

please note order of parameters changed in below example. question - can call below example of method overloading? public void show(string s, int a){ system.out.println("test.show(string, int)"); } public void show(int s, string a){ system.out.println("test.show(int, string)"); } yes, that's absolutely method overloading. from section 8.4.9 of jls : if 2 methods of class (whether both declared in same class, or both inherited class, or 1 declared , 1 inherited) have same name signatures not override-equivalent, method name said overloaded. "override-equivalent" described in section 8.4.2 : two methods have same signature if have same name , argument types. [ ... details on "same argument types ... ] the signature of method m1 subsignature of signature of method m2 if either: m2 has same signature m1, or the signature of m1 same erasure (§4.6) of signature of m2. two method sign

c# - How to Create fluent template which composed of couple of datatemplate -

i trying create fluent page being built other data template. for example: i have 2 datatemplates . datatemplate1 => button , textblock in stackpanel. like: stackpanel << [button] textblockwithtext >> datatemplate2 => textblock , combobox in stackpanel. like: stackpanel << 11111111thisisnewtextblock >> [combobox] and after merge them, third template (something this: stackpanel << datatemplate1 datatemplate 2 >> i not fluent. may in same line, or in 2 line break in middle, like: button text1 \n text2 \n combox. and want thing this: button \n text1 , half of text2 \n last half of text2 , combo box. (according amount of space of window). so, find working wrapping way when using couple of datatemplates (wrapping panel not looking for. search way merge couple of datatemplates - let them wrap each other, won't different part). i have tried work run in document impossible create datatemplate them. any ide

email - Release a file lock that send-mailmessage leaves on error -

i'm using send-mailmessage cmdlet send copy of log file. however, i'd add line log file status of send. code: $to = "toaddress@email.com" $subject = "test email attachment" $from = "fromaddress@email.com" $body = "please find log file attached" $smtpserver = "smtp.server.com" $logfile = "testlog.log" add-content -path $logfile -value "trying email log..." try { send-mailmessage -to $to -subject $subject -from $from -body $body -smtpserver $smtpserver -attachments $logfile -erroraction stop add-content -path $logfile -value "successfully emailed log to: $to" } catch [system.exception] { add-content -path $logfile -value "error emailing log to: $to" } {} error: ps e:\> . .\testmail.ps1 add-content : process cannot access file 'e:\testlog.log' because being used process. @ e:\testmail.ps1:16 char:14 + add-content <<

c# - Access to property in UserPrincipal -

Image
i have directoryservices.accountmanagement.userprincipal object. see using visual studio properties in access them. how can access to, example, property emailaddress ? posible? member.something.emailaddress ? update emailaddress not accesible directly: just use member.emailaddress .... see this msdn page complete list of properties on userprincipal can access directly - , emailaddress 1 of them! update: you're saying cannot access .emailaddress directly... really dealing userprincipal object? try this: userprincipal = (member userprincipal); if (up != null) { string email = up.emailaddress; } can access .emailaddress property on up object??

Regular Language to DFA conversion -

i ran problem in textbook can't decipher , hoping help. i'm not asking solution, translation, or push in right direction. in jflap textbook. the alphabet consists of "a". {a^l |l = 0 (mod 6), l /= 0 (mod 4) } construct dfa recognizes language. i assume if string of a's multiple of 6 string accepted, don't understand l/= 0 mean. there multiple questions this. again, don't need, or want, answer problem, maybe translation english sentence me understand asking for. l /= 0 (mod 4) means l not congruent 0 mod 4 (the opposite of l = 0 (mod 4) ) when write hand, put slash through symbol (like ≠)

Windows Phone thumbnail display -

1)i getting images amazon server , displaying in grid view images not present want display default logo image in local. 2)which best way display image loading progress bar in each grid <image source="defaultimage" height="100" width="100" horizontalalignment="center" verticalalignment="center" x:name="imagedisplay"/> ok, lets start beginning. during app load images - app must presents activity. best way - use progress bar that. new need - create smart own control, witch display progress bar , , when loading finished - display image. (if want can use image instead of progress bar) note: code wp7 mysmartimage.xaml <usercontrol x:class="test.mysmartimage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

jquery - Datatable populated by null, not by JSON -

Image
summary i'm trying populate datatable javascript array containing json. i'm looping through , creating array json inide. when pass datatable, correctly counts rows, not populate them. you can see in screen capture below. data below table array being outputted onto screen. code snippets $(document).ready(function() { $('#content').append( '<br><table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' ); $('#example').datatable({ "aadata" : x, // array containing json "aocolumns": [ { "stitle": "id", "mdata" : "id", sdefaultcontent: "n/a" }, { "stitle": "status", "mdata" : "status", sdefaultcontent: "n/a" }, { "stitle": "date", "

domino designer eclipse - XPage gets signed by an ID used previously -

we use shared development notes ids databases because application breaks if one xpage signed different id others . might get error 403 http web server: forbidden perform operation like got. the problem using multiple ids xpages signed wrong id. when switch id , edit xpage (and other xpages) gets signed id used previously. when select xpage list after , click "sign" button signed id i'm using. anyone else fighting problem , found solutions? have been using windows 7 , windows 8 , designer 9. think quite serious bug. turn off build automatically. have found switch ids have shut down , restart notes using second id.

c++ destroy an object on stack frame -

i try understand happen when object destroy on stack. here sample code: #include <stdio.h> struct b { ~b() {puts("bbbb");} }; int main() { b b; b.~b(); } output bbbb bbbb based on output, can tell object destroy twice.one ~b(), 1 after "}". how , why can object destroy twice? update: after review replies, think destructor doesnt destroy object. there way destroy object before reach out of scope "}". thanks you not supposed invoke destructor hand. what's happening invoking destructor , when object gets popped off stack destructor called again automatically compiler.

input exception error in Java -

i keep getting exception error. simple code. why getting exception error? class thirdprogram { public static void main(string[] args) { system.out.println("hello out there."); system.out.println("i add 2 numbers you."); system.out.println("enter 2 whole numbers on line."); int n1, n2; scanner keyboard = new scanner(system.in); n1 = keyboard.nextint(); n2 = keyboard.nextint(); system.out.println("the sum of 2 numbers is"); system.out.println(n1 + n2); } } when use: http://ideone.com/ do following: step 1 make sure select java on left. step 2 enter code: import java.util.scanner; class thirdprogram { public static void main(string[] args) { system.out.println("hello out there."); system.out.println("i add 2 numbers you."); system.out.println("enter 2 whole numbers on line."); int n1, n2; scanner keyboard = new scanner(system.in); n1 = keyboard.nextint

php - Get all letters before the optional colon -

i have wrapper phpexcel, , have method called setcolumn() , looks this: public function setcolumn($cell = ""){ if(empty($cell)){ $cell = $this->cell; } $this->column = strtoupper(preg_replace("/[^a-za-z]/", "", $cell)); $this->cell = "{$this->column}{$this->row}"; return $this; } it works fine, use it, can pass in ranges such a1:d1 , when do, preg_replace not replace correctly, return ad don't want. want return a . not sure of regular expression needed accomplish this. the parameter $cell can contain few different values: a1 should return a a1:d10 should return a ad10 should return ad ad1:bbb1 should return ad the list go on, basics. can acomplish that? matches digit optional colon after that preg_replace("/\d:?.*/", "", $cell); or linepogl points out just preg_replace("/\d.*/", "", $cell); as long pattern stays: l

bash - Search all untranslated text strings in PHP and HTML files -

i have upcomming task of translating entire website. website partially translated, meaning utilizes translation features of zendframework (v1). translations stored in array based language files this: [en.php] <?php return array( // language config 'config_languagedirection' => 'ltr', // site wide translations 'site_name' => 'my site', 'site_slogan' => 'le slogan', 'site_keywords' => 'key words', 'site_description' => 'yada yada yada', 'header_logo_img_alt' => 'my site', 'fat_footer_company_details' => 'trivial copyright information', 'company_name' => 'unobambino', ); is there script in php or bash/shell, can search directories , find untranslated strings? i'm thinking text in html attributes 'alt' , 'title' text between html tags text in php code, between single , double quo

ruby on rails - Why do I sometimes get `lock': deadlock detected (fatal) error? -

some strange things happening these days. sometimes while pushing heroku following errors: <internal:prelude>:8:in `lock': deadlock detected (fatal) <internal:prelude>:8:in `synchronize' /app/tmp/buildpacks/ruby/vendor/lpxc.rb:57:in `puts' /app/tmp/buildpacks/ruby/lib/language_pack/instrument.rb:10:in `bench_msg' /app/tmp/buildpacks/ruby/lib/language_pack/instrument.rb:23:in `instrument' /app/tmp/buildpacks/ruby/lib/language_pack/base.rb:43:in `instrument' /app/tmp/buildpacks/ruby/lib/language_pack/base.rb:39:in `instrument' /app/tmp/buildpacks/ruby/lib/language_pack/ruby.rb:261:in `install_ruby' /app/tmp/buildpacks/ruby/lib/language_pack/ruby.rb:87:in `block in compile' /app/tmp/buildpacks/ruby/lib/language_pack/instrument.rb:19:in `block (2 levels) in instrument' /app/tmp/buildpacks/ruby/lib/language_pack/instrument.rb:41:in `yield_with_block_depth' /app/tmp/buildpacks/ruby/lib/language_pack/instrument.rb:18:in `blo

Android: Using the accelerometer to detect a flick -

i'm trying develop app user can hit invisible drum using motion of phone. when phone flicked downwards drum sounded @ end of flick. i have managed 90% of working, detecting when large, quick movement stops. although drum being sounded after flick (good) it's being sounded @ end of pull (not desirable). by flick mean phone being flicked forwards , downwards, if striking drum it, , pull mean returning arm starting position. does know efficient way of determining when flick occurs not push? any ideas gratefully received. thanks existing code: package com.example.testaccelerometer; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensorlistener; import android.hardware.sensormanager; import android.os.bundle; import android.app.activity; import android.content.context; import android.view.menu; import android.widget.textview; public class mainactivity extends activity implem

java - TopScore or FilteringMap map, sorted on key -

for lack of better name, calling data structure looking "topscoremap". here requirement. first, size of map fixed. instance, map needs retain top n entries thrown @ map. top n in terms of keys. since map should ordered on keys, chose implement based on java.util.treemap . following have implemented. has passed few test cases. questions : are there existing data structures provide functionality? if not, there way avoid iterations while performing put ? looks o(n^2), worst case. class topscoremap { treemap<integer, string> map = new treemap<integer, string>(); int max = 0; public topscoremap() { this(5); } public topscoremap(int maxcapacity) { this.max = maxcapacity; } public void put(int score, string player) { if (map.size() < max) { map.put(score, player); } else { iterator<integer> = map.keyset().iterator(); while (it.hasnext()) { int currentkey = it.next(); if

java - How to implement singleton pattern using ormlite in Android -

i've been testing various orm in android make object-relational-mapping in app i'm developing. i have made class diagram , have found useful implement singleton pattern in classes. as singleton pattern states singleton class has make constructor of class private enforce unique instance of class. considering ormlite page: 2.1.3 adding no-argument-constructor after have added class , field annotations, need add no-argument constructor @ least package visibility. when object returned query, ormlite constructs object using java reflection , constructor needs called. how can implement pattern using ormlite?, give example: the class colectorprincipal represents user of app, since there 1 person @ time using app want make sure there 1 instance of class @ time. public class colectorprincipal extends persona { @databasefield(index=true) private string numerocoleccionactual; private static colectorprincipal colectorprincipal; @databas

assembly - Is it possible to generate native x86 code for ring0 in gcc? -

i wonder, there ways generate gcc native x86 code (which can booted without os)? the question isn't well-formed. not of instructions needed initialize modern cpu scratch can emitted gcc alone, you'll need use assembly that. that's sort of academic because modern cpus don't document stuff , instead expect hardware manufacturer ship firmware it. after firmware initialization, modern pc leaves either in old-style 16 bit 8086 environment ("legacy" bios) or clean 32 or 64 bit (depending on specific hardware platform) environment called "efi boot services". operations in efi mode done using c function pointers, , can indeed build environment using gcc. see gummiboot boot loader excellent example of working efi.

cordova - Access Phonegap API from Backbone.js model -

i'm developing app backbone.js, require.js , phonegap. i'm having problems accessing phonegap api model. index.html file looks this: <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link href="topcoat/css/topcoat-mobile-light.min.css" rel="stylesheet"> <link href="css/styles.css" rel="stylesheet"> <link href="css/pageslider.css" rel="stylesheet"> <script type="text/javascript" src="cordova.js"></script> <script data-main="js/app" src="js/require.js"></script> </head> <body></body> </html> in initialize function of router, i'm testing phonegap api: initialize: function() { window.localstorage.setitem("key", &

scikit learn - Using a transformer (estimator) to transform the target labels in sklearn.pipeline -

i understand 1 can chain several estimators implement transform method transform x (the feature set) in sklearn.pipeline. have use case transform target labels (like transform labels [1...k] instead of [0, k-1] , love component in pipeline. possible @ using sklearn.pipeline.? no, pipelines pass y through unchanged. transformation outside pipeline. (this known design flaw in scikit-learn, it's never been pressing enough change or extend api.)

c# - jQuery Datatable row links -

i've looked @ many other similar questions mine, haven't found 1 goal quite same. i'm getting rows datatable database using ado.net entity model in asp.net mvc4. want able click link on given row, , have link take me different datatable of rows different database table associated link row clicked on. data binds clicked link new datatable want see in hidden column in each row. i've figured out can data "mrender" function via indices correspond view model in full[] array. i green @ both mvc , jquery, please bear me read code. here view: @using system.web.optimization @{ viewbag.title = "showpeople"; } <h2>showpeople</h2> <div id="example_wrapper" class="datatables_wrapper form-inline" role="grid"> <table border="0" class="table table-striped table-bordered datatable" id="people" aria-describedby="example_info"> <thead>

html - Bootstrap 3 - Trouble Vertically Aligning Input Group Button and Form -

Image
sort of weird problem. i'm following this section having little trouble. when button aligned left of field align when button aligned right (which think of more natural "submit" type behavior) there 5-10px of padding on top of button can't rid of: my code below: <div class="col-sm-7"> <h3>get latest amazon news first:</h3> <div class="input-group"> <input type="text" class="form-control" placeholder="e-mail" /> <span class="input-group-btn"> <button class="btn btn-default btn-group" type="submit">sign up</button> </span> </div><!-- /input-group --> </div><!-- /col-7 --> <div class="col-sm-5"> <h3>get started now:</h3> <a class="btn btn-large btn-primary" href="#"><i class="icon-caret-right icon-space-

android - Mobile device capacity for sending SMS -

suppose live in country don't have access smpp servers , typical sites sending sms (cardboardfish, bulksms, twilio, etc.) fail send sms in country (because don't have updated database of "numbers , carriers"). i wan't have device (with either ios, android or windows phone) notified (with push notifications web application) sending sms bundles (an array of {recipient, message}) my questions are: is feasible solution? will scale? 1 can put more devices when rate more x sms/min how many sms can mobile device send consecutively? can send example 500 consecutively? it doable, though i'm not sure doing via smartphone app best solution - there may limits push notifications, app allowed in background, etc. example, wp apps' background tasks may not run if os thinks there's not enough resources (memory, cpu, etc.) a more realistic solution hook gsm modem or ordinary dumbphone server , send messages through that. there opensource gatewa

c - Table name length in sqlite affects performance. Why? -

i'm noticing length of table names affects performance during creation of tables. here code example reproduces problem: #include <stdio.h> #include <assert.h> #include "sqlite3.h" int main() { int i, sr; char table_query[1000]; sqlite3* db; sr = sqlite3_open("test.db", &db); assert(sr == sqlite_ok); sr = sqlite3_exec(db, "pragma synchronous=off", null, null, null); assert(sr == sqlite_ok); sr = sqlite3_exec(db, "pragma journal_mode=off", null, null, null); assert(sr == sqlite_ok); sr = sqlite3_exec(db, "pragma temp_store=memory", null, null, null); assert(sr == sqlite_ok); sr = sqlite3_exec(db, "begin exclusive transaction;", null, null, null); assert(sr == sqlite_ok); (i = 0; < 10000; ++i) { #ifdef long_names sprintf(table_query, "create table `table_%d_aklkekabcdefghijk4c6f766520416c6c20546865205061696e204177617920496e636c204b796175202620416c626572742

How do I access the contents of the list of eigenvectors and eigenvectors in the C++ Octave API? -

i'm able write program uses c++ octave api find eigenvectors of matrix. here's example: #include <iostream> #include <octave/oct.h> using namespace std; int main() { int n=5; matrix l=matrix(n,n,2); eig eig=eig(l); cout << eig.eigenvalues() << endl; cout << eig.eigenvectors() << endl; return 0; } which returns (-5.46156e-18,0) (-3.1176e-32,0) (-4.86443e-49,0) (3.38528e-16,0) (10,0) (-0.18545,0) (-0.408248,0) (0.707107,0) (-0.31455,0) (0.447214,0) (-0.18545,0) (-0.408248,0) (-0.707107,0) (-0.31455,0) (0.447214,0) (-0.18545,0) (0.816497,0) (-6.72931e-17,0) (-0.31455,0) (0.447214,0) (-0.330948,0) (3.24211e-16,0) (-2.34737e-17,0) (0.830948,0) (0.447214,0) (0.887298,0) (-1.07469e-15,0) (-6.0809e-33,0) (0.112702,0) (0.447214,0) from here, access these eigenvalues -5.46156e-18 , etc., , eigenvector values -0.18545 , etc., floats. how go doing that? don't know syntax. i'll admit i've never use

javascript - JQuery attempt to change window.location incorrectly truncating query parameters -

i'm experimenting jquery fun , i've run bit of brick wall. i'm attempting write login page , thought have form on jsp user enter login id , password , click submit button. gets caught jquery method makes ajax call back-end. "success" method should set window object's location new url indicated value returned ajax call. fyi: i'm back-end guy , have portion covered. problem although call back-end , data require. attempt set new window location url contains single query parameter (to allow app know user is), works base url no query parameters (though there '?' on end of base url) here's jquery code: </script> $(document).ready(function(){ submit( function() { var id = $("#login_id").val(); var pwd = $("#password").val(); var uri = "`http://localhost:8080/sw_server/rest/admin/login`"; $.ajax({ async: false, url: uri,

api - Document response classes with Swagger and ServiceStack -

in petstore example wordnik have provided documentation response classes. example can seen on /pet/{petid} endpoint: pet { name (string, optional), id (integer, optional): foo, category (category, optional), photourls (array[string], optional), tags (array[tag], optional), status (string, optional) = ['available' or 'pending' or 'sold']: pet status in store } it looks supports following parameters: optional (flag specifies if property in response) allowed values description is there way accomplish servicestack implementation? here's servicestack swagger implementation supports, of version 3.9.59: optional: nullable value types described optional. other that, there no support explicitly defining properties in request/response body optional. path or query string parameters, can control optionality using apimemberattribute allowed values: enum types automatically list of allowed values. other types (e.g.

wpf - RepeatBehavior doesn't work in Expression Blend? -

is me or what? repeatbehavior doesn't seem work animations in expression blend 4. have following animation: <doubleanimationusingkeyframes storyboard.targetproperty="(uielement.rendertransform).(transformgroup.children)[2].(rotatetransform.angle)" storyboard.targetname="waitdoc" repeatbehavior="0:0:2"> <easingdoublekeyframe keytime="0:0:1.0" value="0"/> <easingdoublekeyframe keytime="0:0:1.1" value="180"/> <easingdoublekeyframe keytime="0:0:1.2" value="360"/> </doubleanimationusingkeyframes> i expect animation run 2 seconds, instead runs once when click play button in objects , timeline pane. have tried values 5x too, getting same behavior. i don't want run entire project test every minute change. play button should play defined. missing here? edit: in addition, discovered blend doesn't s