Posts

Showing posts from January, 2012

loading - Firebase Rate Limiting -

i'm experiencing huge load times firebase. have 5,000 entries in "users" collection, , working fine until added base64-encoded photo each user. here's summary of code: function initcurrentauth() { return authref.$requireauth().then(attachuserobject); } function attachuserobject(authdata) { getuser(authdata.uid).$loaded().then(function(user) { ...this code never runs because getuser never resolves } } function getuser(id) { userreference = usersref.child(id); return $firebaseobject(userreference); } i'm on free firebase plan, i'm wondering if i'm being throttled? if has insights, appreciated. thanks! not sure if else, in case - frank suggested, did have "listener". had been looking $watch in code trigger it, had $firebaseobject(users) call triggered massive download.

ocr - Can I read this captcha with imagemagick/tesseract? -

Image
i'm week trying read captcha. i'm using imagemagick treat image , tesseract interpret. without success. me? thank you! . convert captcha-novo.png -fuzz -50% -transparent black -fuzz 15% -fill black -opaque 'rgb(16,128,176)' -fuzz 40% -fill white +opaque blue -colorspace gray captcha-interpretado.png . tesseract captcha-interpretado.png page-empty.txt

algorithm - Contextual type for closure argument list expects 1 argument, but 2 were specified -

i'm trying algorithm working swift 2.1: http://users.eecs.northwestern.edu/~wkliao/kmeans/ though getting error on line: return map(zip2sequence(centroids, clustersizes)) { cluster(centroid: $0, size: $1) } here's full function: func kmeans<t : clusteredtype>( points: [t], k: int, seed: uint32, distance: ((t, t) -> float), threshold: float = 0.0001 ) -> [cluster<t>] { let n = points.count assert(k <= n, "k cannot larger total number of points") var centroids = points.randomvalues(seed, num: k) var memberships = [int](count: n, repeatedvalue: -1) var clustersizes = [int](count: k, repeatedvalue: 0) var error: float = 0 var previouserror: float = 0 repeat { error = 0 var newcentroids = [t](count: k, repeatedvalue: t.identity) var newclustersizes = [int](count: k, repeatedvalue: 0) in 0..<n { ...

Android Studio program seems to be getting stuck at HTTPResponse -

i'm working on app in android studio, i'm relatively new , i'm trying pull information website. i'm running problem. code seems sticking @ httpresponse request. i've stuck load of debug logs in , last 1 print "log.v("arg", "trying 2");". i've included applicable code below, can maybe point out i'm doing wrong? appreciated. @override protected string doinbackground(string... medurls) { log.v("arg", "executed"); string medname = "medname"; (string medsearchurl : medurls) { httpclient medclient = new defaulthttpclient(); log.v("arg", medsearchurl); try { log.v("arg", "trying 1"); httpget medget = new httpget(medsearchurl); log.v("arg", "trying 2"); httpresponse medresponse = medclient.execute(medget); log....

ios - Swift: Adding UISegmentedControl/UITextField to dynamic UITableView -

i creating registration form application. app allows users create registration forms, , these registration forms displayed using uitableview. questions can either in form of text input (uitextfield) or multiple choice (uisegmentedcontrol). have question creation working, cannot figure out how display uitextfields , uisegmentedcontrols in uitableview. class use create question: class question { var label: string var required: int // create question init (label: string, required: int) { self.label = label self.required = required if (self.required == 0) { self.label = self.label + " *" } } } class textinput: question { var placeholder: string init (placeholder: string, label: string, required: int) { self.placeholder = placeholder super.init(label: label, required: required) } } class multichoice: question { var answers: [string] init(answers: [string], label: string, required: int) { self.answers = answers super.init(label: ...

return reference to element of dynamic array in C++? -

is how return reference element of dynamically allocated array index ?? int& dynamic_array::operator[](unsigned int i) { if (i >= get_size()) throw exception(subscript_range_exception); else return array[i]; } yes, correct – alexander shishenko thanks

java - Decode UTF-8 String -

import java.nio.charset.charset; import java.security.messagedigest; import java.security.security; import javax.crypto.cipher; import javax.crypto.spec.ivparameterspec; import javax.crypto.spec.secretkeyspec; import org.apache.commons.codec.binary.base64; public class cryptolib { public cryptolib() { security.addprovider(new org.bouncycastle.jce.provider.bouncycastleprovider()); } public string encrypt(string plaintext, string key) throws exception { // convert key bytes messagedigest md = messagedigest.getinstance("md5"); md.update(key.getbytes("utf-8")); byte[] keybytes = md.digest(); // use first 16 bytes (or less if key shorter) byte[] keybytes16 = new byte[16]; system.arraycopy(keybytes, 0, keybytes16, 0, math.min(keybytes.length, 64)); system.arraycopy(keybytes, 0, keybytes16, 0, math.min(keybytes.length, 16)); // convert plain text bytes ...

How to get latest version of android app from Google Playstore? -

question : i want latest version of app in production, google playstore. want add functionality force upgrade, if changes in latest version require it. what have : i updating latest version of app on server, , forcing app request , check version against it. works. not want update on server everytime release new version. want app able pick same information google playstore instead. what need : i can handle logic @ client side (on app). need api call playstore own app's latest production version. if can me pointers on this, helpful. cheers, rohitesh

c - factorial of number using argument recursion(as in function call within argument list) -

my question regarding finding factorial of number using ternary operator in c. code below suggests using recursion, in not function definition, argument list . valid in c ? [note : 0 factorial handled seperate piece of code] the function prototype fact : int fact(int); the definition : int fact(num=(num>1)?num*fact(num-1):1) { return num; } my question is, recursion different instance of same function called within function, can true arguments ? you want this: int fact(int num) { return num > 1 ? num*fact(num-1) : 1; }

c++ string (int) + string (int) -

this question has answer here: how implement big int in c++ 16 answers i have 2 strings, both contain numbers. numbers bigger max of uint64_t . how can still add these 2 numbers , convert result string? well, can either use bigger datatype (for example library deals large integers), or can knock own. i suggest if 1 off, long addition have learned in first few years of school. can operate directly on 2 strings, add columns, 'carry', , build string containing result. can without conversion or binary. here. fun, knocked solution you: string add( const string& a, const string& b ) { // reserve storage result. string result; result.reserve( 1 + std::max(a.size(), b.size()) ); // column positions , carry flag. int apos = a.size(); int bpos = b.size(); int carry = 0; // add columns while( carry > 0...

android - UnParseable date exception at offset 0 java -

i working on android application in trying format date according 2/1/16 5:20 date. getting java.text.parseexception: unparseable date: "2/1/16 5:20 am" (at offset 1). code given below, please me out here. dateformat fafterutc = new simpledateformat("mm dd yy hh:mm aa"); date dselectedafterutc = fafterutc.parse("2/1/16 5:20 am"); your simpledateformat missing /`s: new simpledateformat("mm/dd/yy hh:mm aa")

php - I would like to know how to keep an inventory variable in a class the same for all new objects? -

the problem having keeping inventory variable keep changes made different objects. example, $me object buys 4 items, deducts inventory , leaves 6 in inventory good. make new object $l, inventory starts 10 again, instead of new current inventory of 6. below php code class class cashregister { public $total = 0; public $name; public $discount; public $lastamount; public $inventory = 10; public function __construct($name, $discount) { $this->name = $name; $this->discount = $discount; } public function add($itemcost) { $this->total += $itemcost; $this->lastamount = $itemcost; } public function scan($item, $quantity) { switch ($item) { case "eggs" : $this->add ( 1 * $quantity); $this->inventory($quantity); break; case "news" : $this->add(2 * $quantity); $this-...

python - Sharing numpy arrays between multiple processes without inheritance -

i share numpy arrays between multiple processes. there working solutions here . pass arrays child process through inheritance, not work me because have start few worker processes beforehand , don't know how many arrays i'm going deal later on. there way create such arrays after process started , pass these arrays processes via queues? btw reason i'm not able use multiprocessing.manager .

Convert string into date in SQL Server -

conversion failed when converting date and/or time character string. i'm getting above error when running statement in sql server: select convert(datetime, 'fri, 15 jan 2016 17:30:05 gmt') actually want insert same string format in datetime column as suggested tim biegeleisen, string needs processed converted. in order convert need strip of day ( fri, ) , gmt timezone @ end, example: declare @date varchar(50) = 'fri, 15 jan 2016 17:30:05 gmt' select convert(datetime, substring(@date, 5, len(@date) - 8), 113) this solution strip timezone information, have @ post if want convert utc.

javascript - waypoint addClass and remove class of a "fixed" element works when going down but doesn't going up -

i'm working on website parallax effect using stellar: http://webdesign.tutsplus.com/tutorials/complete-websites/create-a-parallax-scrolling-website-using-stellar-js/ i've got "fixed" div class @ center of page. when scroll down or class changes depending on slide "active". i'm using waypoint , works fine when i'm scrolling down page. when scroll up, instead of changing class, put 1 after other, order shifted , class doesn't match right slide. here html (#square fixed div): <body> <ul class="navigation"> <li id="un" data-slide="1">slide 1</li> <li id="deux" data-slide="2">slide 2</li> <li id="trois" data-slide="3">slide 3</li> <li id="quatre" data-slide="4">slide 4</li> <li id="cinq" data-slide="5">slide 5</li> <li id="six" data-sl...

"ZipException duplicate entry" after upgrading to Android Studio 2.0 Preview 5 -

after upgrading yesterday keep getting these gradle build errors: error:execution failed task ':app:transformclasseswithjarmergingfordebug'. com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: xxx/.../xxxactivity$1.class it happens whatever class i'm working on, e.g. activity class. it's super annoying since have clean project before every build. i using: android studio 2.0 preview 5 , gradle:2.0.0-alpha5 . upgrading newly released alpha8 android studio , gradle plugin resolves issue.

ios - UISlider not working, only display half of the track -

Image
upon inserting uislider interface, greeted strange me in interface builder, half of track gone. figured graphical glitch, because quite common interface builder decided preview application. same issue present. so, ran application find out not issue present, uislider not responsive in way, shape, or form. tried moving slider out of nested view make sure nothing blocking touch events it, although no avail. the reason half of track hidden can seen in picture below: as can see selectors, uislider taking half of space should be, on-top of still has it's default values: minimum: 0 maximum: 1 current: 0.5 mode: scale fill enabled: true now strange part know there's nothing wrong uislider whole, because use in other interfaces/views. can seen working below: i'm not sure go here, can't find reason uislider should not work. i'm not using custom views or viewcontrollers in interface, it's just... not working, , no reason. try set minimum...

I am getting an error in my java program as : constructor Try1 in class Try1 cannot be applied to given types; -

i trying implement constructor overloading in java. think perfect shows error: main.java:28: error: constructor tryme in class tryme cannot applied given types; tryme s=new tryme(1,1,2015); ^ required: no arguments found: int,int,int reason: actual , formal argument lists differ in length 1 error . here code: import java.util.*; class try1 { int day,month,year;`` public void try1() { day = 1; month = 1; year = 2015; } public void try1(int d,int m,int y) { day = d; month = m; year = y; } public void seter() { system.out.println(day+"/"+month+"/"+year); } } class mdate { public static void main(string []str) { try1 t = new try1(); t.seter(); try1 s=new try1(1,1,2015); s.seter(); } } constructor not used explic...

javascript - How to pause slideshow when hovering -

how add pause effect when hover on image in jquery slideshow? $(document).ready(function () { slideshow(); }); function slideshow() { var showing = $('#slideshow .show'); var next = showing.next().length ? showing.next() : showing.parent().children(':first'); var timer; showing.fadeout(500, function () { next.fadein(200).addclass('show'); }).removeclass('show'); settimeout(slideshow, 3000); } var hovering = false; //default not hovering $("#slideshow").hover(function () { //*replace body element hovering = true; //when hovered, hovering true }, function () { hovering = false; //when un-hovered, hovering false slideshow(); //start process again }); function slideshow() { if(!hovering) { //if not hovering, proceed /* code here*/ nextslide(); settimeout(slideshow, 1000); } } ...

How To Read ".XML" File Offline Using Pure JavaScript? -

i trying read .xml file feed using pure javascript in pc show data on browser. can view feed.xml file online saved googleblogxmlfeed . can read online via json want read offline after saving them in file feed.xml in pc. possiable or not? if yes guideline...??? you can not access "user" local file system web page. serious security issue (do want web apps able access files on pc while browsing?). if have file on same server app can access it, make sure have file extension in mime-types. ----- adding code based on comments ------- $.ajax({ url: "feed.xml", success: function(xml){ var xmldoc = $.parsexml( xml ), $xml = $( xmldoc ), title = $xml.find( "title" ).text(); console.log(title); } });

javascript - Bootstrap Remote tabs - load first tab -

i'm using bootstrap-remote-data library load data remotely since have load alot of data every tab. my problem whenever page loaded, first tab not loaded when page does; need click tab , first tab in order load first tab. the above library contains feature of "loadfirsttab:" variable can set true or false, no matter if variable true or false - never loads first tab. been trying play js class , html several hours , couldn't make work , load first tab. this how html looks like: <li class="active"><a data-toggle="tab" href="#tab1" data-tab-url="tab1.php">tab 1 - never loaded on page load!</a></li> <li><a data-toggle="tab" href="#tab2" data-tab-url="tab2.php">">tab2</a></li> <li><a data-toggle="tab" href="#tab3">tab 3</a></li> <li><a data-toggle="tab" href="#tab...

c++ - Qt5: How to hide or remove a QMenu from the QMenuBar? -

i using qt5 on windows7 platform: qt creator version is: v3.3.2. qt version 5.5.1 , mingw 32bit. currently, in menu bar have: configuration - reports - help i searched , found possible answer: not possible hide qmenu object qmenu::setvisible()? , it didn't work ... so, trying remove menu using: ui->menuhelp->setvisible(false); and: ui->menuhelp->menuaction()->setvisible(false); unfortunatelly, both failed hide/remove help menu... please, there other way it? [code]: mainwindow::mainwindow(qwidget * parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); this->setwindowflags(this->windowflags() & ~qt::windowmaximizebuttonhint); if(!server.listen(qhostaddress("192.168.1.2"), 8001)) return; if(true) // testing... ui->menuhelp->menuaction()->setvisible(false); } just test, i've added 3 menus menubar . tried this: ...

java - Javafx Webview Exception -

i trying load page webview. when try load https://www.google.com/ doesn't complain, when try load other sites throws below exception: jan 16, 2016 4:14:20 pm com.sun.webkit.network.urlloader dorun warning: unexpected error java.lang.illegalargumentexception: protocol = https host = null @ sun.net.spi.defaultproxyselector.select(defaultproxyselector.java:176) @ sun.net.www.protocol.http.httpurlconnection.plainconnect0(httpurlconnection.java:1099) @ sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnection.java:999) @ sun.net.www.protocol.https.abstractdelegatehttpsurlconnection.connect(abstractdelegatehttpsurlconnection.java:177) @ sun.net.www.protocol.http.httpurlconnection.getinputstream0(httpurlconnection.java:1513) @ sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1441) @ sun.net.www.protocol.https.httpsurlconnectionimpl.getinputstream(httpsurlconnectionimpl.java:254) @ com...

.net - WPF can't find simple resources anymore -

i have simple demo application use testing purposes. added resource dictionary , wpf fails find resources @ runtime. visual studio regards resources fine , shows styles in visual designer, when application run, xamlparseexception saying resource not found. code nothing else other working applications, can't find difference. what's problem that? here's example of resource dictionary appresources.xaml: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!-- there need @ least 2 styles if startupuri not used. --> <!-- see http://bengribaudo.com/blog/2010/08/19/106/bug-single-application-resources-entry-ignored --> <style x:key="__unused"/> <style x:key="infolabelstyle" targettype="textblock"> <setter property="foreground" value="green"/> ...

Swift - Wrong date format (JSON .NET) -

i'm trying make api call alamofire in app, strange error. 'there error deserializing object of type tucson.geocaching.wcf.api.createtrackablelogrequestv1. datetime content '\/date(1452942271163+0500)\/' not start '\/date(' , end ')\/' required json.' on website of api date format must this: "\/date(928174800000-0700)\/" my code: posttblog("gsycnp", text: "test", date: "\\/date(928174800000-0700)\\/", logtype: 48) func posttblog (code: string, text: string, date: string, logtype: int) -> bool { if let apikey = apikey { let url = "https://api.groundspeak.com/livev6/geocaching.svc/createtrackablelog" let parameters:[string : anyobject] = ["accesstoken":apikey, "trackingnumber":code, "utcdatelogged": date, "note":text, "logtype":logtype] alamofire.request(.post, url, parameters: parameters, encoding: .json).re...

c# - How to modify only one or two field(s) in LINQ projections? -

i have linq query: list<customers> customers = customermanager.getcustomers(); return customers.select(i => new customer { fullname = i.fullname, birthday = i.birthday, score = i.score, // here, i've got more fields fill isvip = determinevip(i.score) }).tolist(); in other words, want 1 or 2 fields of list of customers modified based on condition, in business method. i've got 2 ways this, using for...each loop, loop on customers , modify field (imperative approach) using linq projection (declarative approach) is there technique used in linq query, modify 1 property in projection? example, like: return customers.select(i => new customer { result = // telling linq fill other properties isvip = determinevip(i.score) // modifying 1 property }).tolist(); you can use return customers.select(i => { i.isvip = determinevip(i.score); return i; }).tolist();

html - When drawing on a canvas, should calculations be done relative to cartesian plane coordinates? -

i've been seeing lot of canvas-graphics-related javascript projects , libraries lately , wondering how handle coordinate system. when drawing shapes , vectors on canvas, points calculated based on cartesian plane , converted canvas, or calculated directly canvas? i tried playing around drawing circle graphing tangent lines until line intersections start resemble curve , found difference between cartesian planes i'm familiar , coordinate system used web browsers confusing. function circle, example, "y^2 + x^2 = r^2" need translated "(y-1)^2 + (x-1)^2 = r^2" seen on canvas. , negative slopes positive slopes on canvas , upside down :/ . the easiest way me think pretend origin of cartesian plane in center of canvas , adjust coordinates accordingly. on 500 x 500 canvas, center 250,250, if ended point @ 50,50, drawn @ (250 + 50, 250 - 50) = (300, 200). i feeling i'm over-complicating this, can't wrap mind around clean way work canvas. cu...

c++ - Creating unsigned 80 bit variable -

how can create 80 bit unsigned variable? after creating, need shifting operation in case; unsigned long long key=0x00000000000000000000 valid? there const unsigned __int64 ; can change unsigned __int80 ? your fundamental data types limited architecture of computer, 8-bit, 16-bit, , 32-bit integers, , possibly 64-bit integers. some machines have clever extensions 128-bit integers, on others have compose types achieve that, done in background so-called "bigint" libraries. might, example, wrap 2 64-bit integers "128-bit integer" class transparently handles carry-over when incrementing/decrementing resulting value. there's no particular reason can think of can't apply same logic "bigint" class wraps 64-bit integer , 16-bit integer, or 5 16-bit integers — best depends on use case, try both , measure. i boost.largeint 1 , write typedef large_int<uint64_t, uint16_t> uint80_t; on writing program. as happens, library has exam...

php - insert data in corresponding tables from multistep form -

i have multistep form called "card" this form must contain sevral information of person, person has done, job of person, tools person used etc. to solve , make more cool made multiform step form, when user finishes filling data first table (for instace information of tools used) user clicks on next step button , inputs other table showed (project person has worked)... keeps on going till user fills necessary data. save work using grocerycrud. <form method="post" action="<?php echo base_url();?>controller/save" name="form"/> <label>user name</label> <input type="text" name="username"> <input type="submit" value="add"/> <!--####################### several more data store in distict tables ####################### --> </form> in controller: function save { $arrdata["username"] = $this->input->...

ruby on rails - NoMethodError: undefined method `substitute_at' for nil:NilClass -

i getting issue while destroying object. nomethoderror: undefined method `substitute_at' nil:nilclass /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activerecord-3.2.11/lib/active_record/persistence.rb:135:in `destroy' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activerecord-3.2.11/lib/active_record/locking/optimistic.rb:103:in `destroy' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activerecord-3.2.11/lib/active_record/callbacks.rb:254:in `block in destroy' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:480:in `_run__348799253__destroy__466331341__callbacks' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks' /usr/local/rvm/gems/ruby-1.9.3-p194@clu2/gems/activesupport-3.2.11/lib/active_support/callbac...

php - Custom Pagination Display Total Page Numbers Of Posts -

i trying custom pagination in wordpress not no how show page 1 of 7 example in css have defined. you can see here : http://kvalixhu.digitalthinkersni.co.uk/blog/ @ bottom of page trying acheive. i looking here @ codex couldnt find how page numbers can show 1/7 2/7 3/7 example ? <div class="pagination"> <ul> <li class="previous"> <a href="">&lt;</a> </li> <li class="number"> <a href="">1/7</a> </li> <li class="next"> <a href="">&gt;</a> </li> </ul> </div> i here dont tell me how total pages show have idea how achieve this. you can current page in with: $current_page = get_query_var( 'paged' ); total number of pages current query: global $wp_query; $pages = $wp_query->max_num_pages; maybe must check article: how-to-add-word...

class - Simple C++ Logging -

i have been set task of: to evolve logger class can integrated projects/developments, declaring single global instance; used capture , save log information. there 2 levels acceptable: logger - debug code in source, no class. logger - packaged in class, default behavior (not configurable). controlled _debug , writes std::clog (can re-directed). i not know start this, , have spent hours trying find somewhere. your task may use more complex logger class makes logging throughout entire project easier due functionalities such being able break string on multiple lines of code when debugging it separate methods between error logging , debug logging being able turn logging on/off logger instance, debug messages throughout project become obsolete (instead of needing comment of them instance) adding other methods specific case (you see below) this logger class used windows project. supports features mentioned. feel free use it. #include "logger.h" ...

javascript - Script/Links tags vs AJAX loading -

i want load script tags , link tags. can follows <script src="sample.js" type="text/javascript"></script> <link type="text/css" href="sample.css" rel="stylesheet"></link> (or) $.ajax({ url: 'sample.js', datatype: 'script', success: function(data) {}, error: function(data) {} }); but want know 1 best/secure way[generally]. i think can handle errors ajax loading or else have check onload function find whether scripts loaded , find whether links loaded need loop through document.stylesheets . any suggestions? my main concern find whether scripts & links loaded , secured way , testing don't prefer code this. as javascript files: javascript has blocking nature. if going load multiple external js files on page 1 one, consider each loaded , executed. if error occurs while execution of javascript file can observe in developer console. unfortunately, ...

html - Dynamic graph with xml and xslt -

how can make dynamic graph xml file , xslt or html. i've got projekt going need keep on using xml , 1 of xslt or html. xml file has historical data prices , update every 2 seconds. looking ideas , advice how make graph updates new values every 2 seconds. the graph shown in browser. in web browser can read data files, served web-server. you need make javascript method re-read xml file via ajax request each 2 seconds, , apply xml data xslt/html part.

c# - Attempting to get a count of records from gridview based on a selected date from dropdownlist but cant? -

the problem lies upon selection of date in dropdown give count of last selection, not current. novice , thing can think of type of postback issue? gridview populates fine records selected ddl, cant head around why count rendered previous selection. protected void ddlclassdate_selectedindexchanged(object sender, eventargs e) { lblrecordcounter.text = ""; sqlconnection conn; sqlcommand comm; sqldatareader reader; string connectionstring = configurationmanager.connectionstrings["gescdb"].connectionstring; conn = new sqlconnection(connectionstring); comm = new sqlcommand("select (*) gescdb" + "where classdate=" + ddlclassdate.text, conn); try { conn.open(); reader = comm.executereader(); gridregistrants.datasource = reader; gridregistrants.databind(); reader.cl...

c# - TextBox.TextAlign right-side alignment has no effect in certain conditions? -

i have path selector in visual c# express 2010 form application. i using folderbrowserdialog , (single line) textbox , show selected path. using following line in ui refresh code. this.textboxfolder.text = this.folderbrowserdialog1.selectedpath; the readonly property set true , textalign property set right using form designer, because selected path longer textbox, , prefer show right-side of path. forms designer generates this: // // textboxfolder // this.textboxfolder.location = new system.drawing.point(40, 72); this.textboxfolder.name = "textboxfolder"; this.textboxfolder.readonly = true; this.textboxfolder.size = new system.drawing.size(160, 20); this.textboxfolder.tabindex = 13; this.textboxfolder.tabstop = false; this.textboxfolder.textalign = system.windows.forms.horizontalalignment.right; whenever chosen path shorter textbox size, right alignment works. (but not important) whenever chosen path longer textbox size, right alignment has no effect, s...

c - Deleting a node from RST tree using double pointers -

i've got rst tree structure is: struct node { int key; node *left, *right; } *root; my function aim delete node 'v' key: void delete (int v) { node** p = search(v); node** tmp = p; if (!(*p)) return; if((*p)->left==null && (*p)->right==null) { p = null; return; } while((*tmp)->left != null || (*tmp)->right != null) { if ((*tmp)->left != null) tmp = &((*tmp)->left); else tmp = &((*tmp)->right); } (*tmp)->right = (*p)->right; (*tmp)->left = (*p)->left; p = tmp; tmp = null; } generally not sure when should write 'tmp' , '*tmp'. can explain me mistakes here? (!tmp)->right == null node** temp = p; temp->right, temp alone pointer node pointer. has no right. (*temp)->right.

How do you collect input and store it as a var in html -

this short chunk of code , i'm trying learn html , seems right doesn't work. i'm not sure whats incorrect. <!doctype html> <html> <head> <title> youtube unblocker </title> <style> h1 {text-align:center;} </style> </head> <body bgcolor="#00ff80"> <font color="white" size="7"> <h1>youtube unblocker </h1> </font> <input type="text" id="urllink"> <button type="submit" onclick="getlink()">submit</button> <script> function getlink() { var input = document.getelementbyid("urllink")(); alert(input); } </script> </body> </html> variables in javascript, not in html. try please: var input = document.getelementbyid("urllink...

angularjs - How does one test Angular 2 with Mocha? -

i've been banging head against few days, , can't anywhere.. i'm trying use mocha test angular 2 app (systemjs-based if matters), , can't figure out how instances of controllers. i'm trying simplest case can come with; import {bootstrap} 'angular2/platform/browser'; import {app} '../app/app'; import {type} 'angular2/core'; describe('login', () => { let app:app; beforeeach((done) => { console.log(bootstrap); bootstrap(<type>app) .then(result => result.instance) .then(instance => { app = instance; done(); }); }); it('test app exist', (done) => { console.log(app); done(); }); }); as best can tell, console.log(bootstrap) fails somehow, gulp-mocha task dies (silently). commenting out bootstrap references dummy test; import {bootstrap} 'angular2/platform/browser'; import ...

android - StrictMode$InstanceCountViolation when changing orientation -

i have activity tabs , have problem when rotate device. when start e.g. app in portrait mode rotate landscape , again portrait app crashed , in logcat see: android.os.strictmode$instancecountviolation: class com.example.myactivity; instances=2; limit=1 this activity's oncreate() method: mtabmanager = new tabmanager(this, mtabhost, r.id.realtabcontent, r.id.realtabcontentleft); mtabmanager.addtab(mtabhost.newtabspec(tab1_id).setindicator(indicator1), fragment.class, args, sendtype.send1); mtabmanager.addtab(mtabhost.newtabspec(tab2_id).setindicator(indicator2), fragment.class, args, sendtype.send2); if (savedinstancestate != null || shouldsetcurrenttag) { mtabhost.setcurrenttabbytag(currenttabtag); } fragment class - empty class extends sherlockfragment (i use actionbarsherlock). here tabmanager class: public static class tabmanager implements tabhost.ontabchangelistener { private final fragmentactivity mactivity; private final tabhost mtabhost; ...

height - android change button size according to device screen size -

i want adjust app design android devices, tried set elements size properties percentage in truble way tried code:(set width , height device screen size / 5) public void fixbuttonsizes (){ display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); int width1 = size.x; int height1 = size.y; button button1vid = (button) findviewbyid(r.id.button1); button1vid.setheight(height1 / 5); button1vid.setwidth(width1 / 5); } and it`s not work me too to use percentage width or height in android should wrap elements inside linearlayout , use layout_weight property of element. have put 0dp in layout_width or layout_width according dimension want. to calculate height or width element have, have sum layout_weight of elements in layout , divide weight of element. for instance, if want create 5 buttons horizontally same width can use this: <linearlayout android:layout_width="match_paren...

c# - Mapping BsonDocument to class but getting error -

this bsondocument extract mongodb collection. deserialize (or map) object/class made in c#. { "_id" : objectid("5699715218a323101c663b9a"), "type": null, "text": "hello text", "user": { "hair": "brown", "age": 64 } } this class map/deserialize bsondocument to. fields inside class ones retrieve. public class mytype { public bsonobjectid _id { get; set; } public bsonstring text { get; set; } } currently how trying getting error "element 'type' not match field or property of class mytype". not want include "type" field in mytype class. var collection = db.getcollection<bsondocument>("data_of_interest"); var filter = new bsondocument(); var mydata = collection.find(filter).firstordefault(); mytype myobject = bsonserializer.deserialize<mytype>(mydata); i'm getting erro...