Posts

Showing posts from February, 2014

floating point precision - php sum zero value to float number -

i'm in trouble this: $price = 26,20; $increase = 0,00; $decrease = 0,00; $result = ($price + $increase - $decrease); result becomes 26 instead of 26,20 any idea? thnx! you can use number_format in case need comma decimal separator, see example below: $price = 26.20; $increase = 0.00; $decrease = 0.00; $result = ($price + $increase - $decrease); echo number_format($result , 2, ',', '');

java - Create a global instance of an object within Android Studio App -

i designing game in android studio. have activity multiple fragments on it. have player object want create instance of. player player1 = new player(); all these fragmenets on activity making changes player1. instead of passing object each fragment , successive activity with: intent.putextra("player",player1); is there way access player1 other fragments , activities without going through trouble of passing putextra() method? i tried making player1 static: static player player1 = new player(); but, couldnt access player1 other .java activity files. so, basically, want strategy make player1 global object can reference whenever , wherever. don't want make methods within player class static, because want able have player1 , player2 , , player3 files on game, need able create instance of player , , don't think can done if every method static (right?) i started oop, sure there's simple overlooking, or perhaps rather messing modifiers there bet

class - How to Create a Printing Method in Python -

i'm new python , have little background in c++. i'm getting mind around object oriented programming, having problem defining print methods in class created. have read both repr() , str() functions, neither of them seems work. class chicken(): def __init__(self, name, eatable, species): self.name=name if eatable!="yes" , eatable!="no": self.eatable="no" else: self.eatable=eatable self.species=species #print species when called #doesnt work reason def print_species(self): print "%s" %str(self.species) #print whether or not bird eatable #this method doesnt work def print_eatable(self): print "%s" %str(self.eatable) def change_species(self, new_name): self.species=new_name def change_eatable(self, new_status): self.eatable=new_status if new_status!="yes" , new_status!="no":

Word VBA - DocumentBeforeSave event? -

i using following vba code make message box appear while saving word document, public withevents appword word.application private sub appword_documentbeforesave _ (byval doc document, _ saveasui boolean, _ cancel boolean) dim intresponse integer intresponse = msgbox("do want " _ & "save document?", _ vbyesno) if intresponse = vbno cancel = true end sub this code written in class. not work. nothing happens when saving. issue here? i made work. analystcave.com help. did: i create new class named eventclassmodule , copied following code, public withevents app word.application private sub app_documentbeforesave _ (byval doc document, _ saveasui boolean, _ cancel boolean) dim intresponse integer intresponse = msgbox("do want " _ & "save document?", _ vbyesno) if intresponse = vbno cancel = true end sub then created module named mdleventconnect , copied following code, dim x new even

html - CSS border-radius Property Not Working -

this question has answer here: border-radius , padding not playing nice 3 answers i run website on tumblr. added css border-radius property , set 20px images specific id. however, can see, corners on right side of image not rounded, left side corners are. the css code looks this: #articleimage { float:left; padding-right: 10px; padding-bottom: 1px; width: 400px; border-radius:20px; } i've determined issue caused padding right, require css property. how can stop conflict? view screenshot: http://i.stack.imgur.com/es0aa.png try changing padding margin: #articleimage { float:left; margin-right: 10px; margin-bottom: 1px; width: 400px; border-radius:20px; }

vb.net - Button click on RepositoryItemButtonEdit in gridview doesn't trigger any events in DevExpress -

i have gridview 3 columns multiple rows. first 2 columns consists of client's id number , client's name. third column repositoryitembuttonedit button that, when clicked, delete client row. i've declared repositoryitembuttonedit following way. dim withevents buttondelete repositoryitembuttonedit buttondelete = new repositoryitembuttonedit buttondelete.texteditstyle = texteditstyles.hidetexteditor buttondelete.buttons(0).kind = buttonpredefines.glyph buttondelete.buttons(0).caption = "supprimer" addhandler buttondelete.click, addressof me.button_click i've added third column following way. dim unbcolumn gridcolumn = gvexception.columns.addfield("delete") unbcolumn.visibleindex = gvexception.columns.count unbcolumn.columnedit = buttondelete gvexception.optionsview.showbuttonmode = devexpress.xtragrid.views.base.showbuttonmodeenum.showalways the 'button click' event captured foll

c# - ASP.NET 5 / MVC 6 equivalent of HttpException -

in mvc 5 throw httpexception http code , set response so: throw new httpexception((int)httpstatuscode.badrequest, "bad request."); httpexception not exist in asp.net 5 / mvc 6. equivalent code? after brief chat @davidfowl , seems asp.net 5 has no such notion of httpexception or httpresponseexception "magically" turn response messages. what can do, hook asp.net 5 pipeline via middleware , , create 1 handles exceptions you. here example source code of error handler middleware set response status code 500 in case of exception further pipeline: public class errorhandlermiddleware { private readonly requestdelegate _next; private readonly errorhandleroptions _options; private readonly ilogger _logger; public errorhandlermiddleware(requestdelegate next, iloggerfactory loggerfactory, errorhandleroptions options) { _next = next; _options = opti

actionscript 3 - Can't make MovieClip in function dissapear -

i'm trying make simple shooting game fiat multipla falling bottom of screen. have created function generate falling multipla , within function have problem. the main issue after change of multideath status 1 "death" function nothing if kept enter_frame. child becomes invisible implemented in multipla movieclip, after response there death = 1, nothing happens. i'm new this, i've met , solved few issues during programming, here's brickwall now. code's either failing or don't know that's obvious. said, i'm newbie. thanks lot help! here's function: import flash.events.event; import flash.desktop.nativeapplication; multitouch.inputmode = multitouchinputmode.touch_point; mouse.hide(); var velocity = 0; var ammo = 6; lgui.lguiammo.gotoandstop(6); var counter = 0; function multiplarain() { var x1 = math.ceil(math.random() * 280); var y1 = -200; var random:multipla = new multipla(); var life = 265; var multideath = 0; random.x = 1

r - Exporting Hive to CSV with data type integrity -

the table present in hive in following format: desc table_name; col_id double col_ts string col_nm string cols_nm string col_cd string col_state_cd string i using following code export csv : hive -e 'set hive.cli.print.header=true; select * table_name' | sed 's/[\t]/,/g' > /home/yourfile.csv but when read through r, data type of col_id changes strings. how ensure data format same in hive? try hadley wickham's readr package -- it's great @ guessing @ data types. require(readr) demo_tables <- read_csv("my_table.csv")

Create isolines shape-file by Geotools -

i have array (grid) of points (coordinates x,y , attribute top). need build isolines them (basis of attribute top values) , create shape-file. i use geotools java library , i'm able create shape-file set of linestring. unfortunately have no idea array of point isolines. does geotools have way build isolines automatically? geotools considers contouring (which geographers call isolines :-)) imaging operation outsourced jai-tools library. the basic process convert array of points image , call contouring process on jai op. there full demo here .

jquery - Pikachoose compatibility with Colorbox -

i'm trying use pikachoose (an image slider) along colorbox (alternative lightbox, had same issue on), whenever click on image (not thumbnail), image opens in whole new window. pikachoose working expected. i've followed "usage" page exactly, , checked mine against examples code, , they're identical except links between images. can see i've got separate image outside of <div class='pikachoose'> tag, works expected. does know how make 2 compatible? here code i've used. i've omitted <link> , <script> tags save space know i've got them correct. <head> <script> $(document).ready(function (){ $("#pikame").pikachoose(); }); </script> </head> <body> <div class="pikachoose"> <ul id="pikame"> <!-- override thumbnails use <img src="thumbnail.jpg" ref="fullsize.jpg"> --> <li>&l

haskell - Is it possible to represent this transformation in a strongly typed manner? -

i'm looking perform transformation (in f#): type test = tbool of bool | tstring of string type testlist = tlbool of bool list | tlstring of string list let transform : map<int, test> list -> map<int, testlist> = ?? is there way encode such "know" while map contains heterogeneous values, value @ each position same type across elements of containing list? maps of static size once constructed , same across each list element, size not known in advance i'm looking generate tuples/records of unknown size. edit i think example unclear. root of i'm after able take 2 variable sized collections values @ given position same type, collection can contain values of multiple types, , "zip" them using knowledge @ given position 2 values same type. specifically, don't want have recheck same , propagate condition vary (as error of sort), since when creating collections. edit 2 from comment posted below: want heterogenous lists (i used

c - Parse string into argv/argc -

is there way in c parse piece of text , obtain values argv , argc, if text had been passed application on command line? this doesn't have work on windows, linux - don't care quoting of arguments. if glib solution overkill case may consider coding 1 yourself. then can: scan string , count how many arguments there (and argc) allocate array of char * (for argv) rescan string, assign pointers in allocated array , replace spaces '\0' (if can't modify string containing arguments, should duplicate it). don't forget free have allocated! the diagram below should clarify (hopefully): aa bbb ccc "dd d" ee <- original string aa0bbb0ccc00dd d00ee0 <- transformed string | | | | | argv[0] __/ / / / / argv[1] ____/ / / / argv[2] _______/ / / argv[3] ___________/ / argv[4] ________________/ a possible api be: char **pa

javascript - delete node from a user created google maps polyline -

i need allow users create polylines on google map , allow them delete node between polylines created. result of removal should new polyline connecting 2 new neighboring nodes. @ moment i'm struggling allowing user delete node. i've researched bit , found a google reference , this question . unfortunately, both of them assume have reference polyline somewhere, don't, since polyline being created dynamically user. this code use : function initialize() { var mapoptions = { center: { lat: 45.797436, lng: 24.152044 }, zoom: 12 }; var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var drawingmanager = new google.maps.drawing.drawingmanager({ drawingmode: google.maps.drawing.overlaytype.marker, drawingcontrol: true, drawingcontroloptions: { position: google.maps.controlposition.top_center, drawingmodes: [ google.maps.drawing.overl

javascript - strings get concatenated on other end in TLS socket connection in node -

i tailing file using tail-always , transferring data server using tls socket in node. here code transfer lines server var client = tls.connect(port,serveraddress, options, function() { tail.on('line', function(data) { console.log(data.tostring('utf-8')) client.write(data.tostring('utf-8')); }); tail.on('error', function(data) { console.log("error:", data); }); tail.watch(); }); on side server listens port , grabs text. code : var server = tls.createserver(options, function(tslsender) { tslsender.on('data', function(data) { console.log(data.tostring('utf-8')); }); tslsender.on('close', function() { console.log('closed connection'); }); }); the program works when single line added @ time file , when multiple line added file lines gets concatenated on server side.i have confirmed not getting concatenated before

javascript - Verify values in combo box exist or don't exist? -

how can verify items listed in combo box? example want check if combo box have "item1" "item2" "item3". how output options out , check? here's how excess combobox: ext.componentquery.query('combobox[name=boxname]')[0]; just access store of box , interrogate it. example: var store = ext.componentquery.query('combobox[name=boxname]')[0].getstore(); console.log(store.getbyid('item1')); if item1 not there result null . update: based on conditions lets say, want able validate combo box has "item1" , "item2", not more or less. given variable target contains want in combo, can verify combo way: var target = ['item1', 'item2'], combo = ext.componentquery.query('combobox[name=boxname]')[0], check = function(combo, target) { var store = combo.getstore(); if (target.length !== store.gettotalcount()) { return false; }

checkbox - multiple check box error in rails with the help of hash -

in @eyecolor contain hash {"brown"=>"brown", "black"=>"black", "blue"=>"blue", "green"=>"green"}. now want show multiple check box in rails, , have implement code this <%= check_boxes_tag "eyecolor[]", options_for_select(@eyecolor, params['eyecolor']),{:multiple => true,:size=>5} %> and want check black but didn't show me multiple checkbox, display me 1 check box.

vba - VBS crashing excel -

i have 4 macros: 1) thisworkbook.turn_off_alerts: turns off excel alerts 2) refresh_base: updates data sql connection 3) refresh_pivot: refreshes pivot table base data , saves workbook. 4) send_range_or_whole_worksheet_with_mailenvelope: emails pivot table group of users each of these runs fine individually, simplify little, created run_all calls these 4 macros in order. copied vbs file online run report, when execute it, "microsoft excel has stopped working" message , finished message, email did not send , file not saved. here code using: option explicit dim xlapp, xlbook set xlapp = createobject("excel.application") set xlbook = xlapp.workbooks.open("y:\overrides expiring in next 30 days.xlsm", 0, true) xlapp.run "run_all" xlbook.close xlapp.quit set xlbook = nothing set xlapp = nothing wscript.echo "finished." wscript.quit edit: macro breaking it. works in ex

java - Where is the keyboard specified the System.in method? -

i can't conceptually understand in below code (that retrieves characters keyboards , prints command line) specified input must come keyboard? public class adder { public static void main(string arr[]) { //explain next line, please: scanner in = new scanner(system.in); system.out.println("enter first no."); int = in.nextint(); system.out.println("enter second no."); int b = in.nextint(); int c = a+b; system.out.println("sum is: "+c); } } system.in isn't method, it's field that's tied keyboard default. the "standard" input stream. stream open , ready supply input data. typically stream corresponds keyboard input or input source specified host environment or user. you can call system.setin(inputstream in) method change different input stream. reference: i/o command line

ios - Slient push notification to open App -

i'm new ios platform please bear me. we developing app enable user perform in-app video chat, video chat considering opentalk sdk. so here scenario, user starts video chat session user b, request sent server generating sessionid , token (which passed client), server returns sessionid , token user a, problem arises how pass same sessionid , token user b, video chat can started. we thought of using apn service send notification user b along sessionid , token in payload, not user experience, because appear in notification window, if user offline notification show once online (of don't see use). any highly appreciated. ios 7+ supports "silent push notifications". the aps dictionary can contain content-available property. content-available property value of 1 lets remote notification act “silent” notification. when silent notification arrives, ios wakes app in background can new data server or background information processing. users are

c++ - par2tbb fails to compile with an "auto_ptr is not a member of std" error -

i trying compile par2tbb on gentoo linux kernel 3.18.12, , keep getting following compilation error: par2cmdline.cpp: in function ‘int main(int, char**)’: par2cmdline.cpp:88:3: error: ‘auto_ptr’ not member of ‘std’ std::auto_ptr<commandline> commandline(new commandline); ^ i checked #include <memory.h> present on source code, added cxxflags = -std=c++11 makefile, , still won't compile. looking online, these 2 measures fixes find. idea on what's going on?

java - Downloading algorithm -

i have weird question. want create down-loader tool. idea have in mind is, while downloading file source should able divide file in chunks. example. if size of file 100 mb want 5 streams pointing machine download 20mb each simultaneously makes 5*20=100. solution have problem client down-loader tool there server. first file downloaded on cloud server(coz speed fast take seconds). , server can many streams want depending on size of file. idea make me utilize full bandwidth of connection. i'm using java btw!!! if original location of file on slow server, downloading cloud server won't fast. when it's on cloud server, won't faster download in separate chunks in 1 chunk. therefore idea doesn't work, except in case reason cloud server able download file faster directly. that's not how networking works.

java - How to read data from two text files and linking the data? -

i want read data host.txt , instance.txt , able read data i'm not sure how can linked! here host file: host id number of slots data centre ======= =============== ============ 2, 4, 0 5, 4, 0 7, 3, 0 9, 3, 1 3, 3, 1 10, 2, 2 6, 4, 2 8, 2, 2 here instance file: instance id customer host id =========== ========= ======= 1, 8, 2 2, 8, 2 3, 8, 2 4, 8, 7 5, 15, 7 6, 16, 9 7, 13, 9 8,

socket.io - Which type of diagram is used for denoting Client / Server socket programming? -

Image
i have developed couple of socket based interactive web applications team have found pain document conditional flow of data. i have used sequence diagram these is best way document socket programming? there uml standard socket programming? edit : not uml diagram simple representation. to create connection-oriented socket, separate sequences of functions must used server programs , client programs, can represent socket connection :

explanation on simple c++ inheritance -

#include <iostream> using namespace std; class { public: void m1(){ cout << 'a'; } virtual void m2(){ cout << 'b'; } virtual void m3(){ cout << 'c'; } }; class b: public { public: void m1(){ cout << 'd'; } void m2(){ cout << 'e'; } }; class c: public b { public: void m3(){ cout << 'f'; } }; int main() { cout << "hello world!" << endl; a* = new b(); a->m1(); a->m2(); a->m3(); return 0; } what output? thought "d e c" after running program "a e c" could 1 elaborate going on behind line of code: a* = new b(); virtual member functions dispatched based on dynamic (run-time) type of object. non-virtual member functions dispatched based on static (compile-time) type of object. a *a = new b(); a points object dynamic type b . static type of a a* , however, means static type of *

java - DAO persistence: only one method to store a complex data object? -

here have: public final class product { integer productid; string description; ... public product(final integer productid, final string descripcion, ...) { this.product_id = productid; this.description = description; ... } public integer getproductid() { ... } public string getdescription() {...} ... } an then: public final productdetails { integer productid; string serialnumber; ... public productdatails(final integer productid, final serialnumber, ...){ ... } public intger getproductid() { ... } public string getserialnumber { ... } ... } so, in order build dao persists data 2 classes contain, question if practice follows: public interface iproductdao { public void saveproduct(final product product); public void saveproductdetails(final productdetails productdetails); } or: public interface iproductdao { public void saveproduct(final product product, final productdetails productdetails); i have been taking i

javascript - Composer update fails while updating the composer -

$ php composer.phar update loading composer repositories package information updating dependencies (including require-dev) requirements not resolved installable set of packages. problem 1 - anahkiasen/rocketeer-slack dev-master requires anahkiasen/rocketeer ^2.2 - no matching package found. - anahkiasen/rocketeer-slack dev-master requires anahkiasen/rocketeer ^2.2 - no matching package found. - installation request anahkiasen/rocketeer-slack dev-master -> satisfia ble anahkiasen/rocketeer-slack[dev-master]. potential causes: - typo in package name - package not available in stable-enough version according min imum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3aseiflrc/discussion f or more details. read https://getcomposer.org/doc/articles/troubleshooting.md further commo n problems. i changed "anahkiasen/rocketeer-slack": "2.0.*@dev", instead of "anahkiasen/rocketeer-slack":

Android App Crashes if no internet during server connection -

i calling url fetch data , insert in database. have provided no internet check. if open app without internet connection, works fins, pop comes.. if connect url when have internet , internet goes in middle process, app crashes, how fix it? my code: public class dopostpen extends asynctask<string, void, boolean> implements oncancellistener { @suppresswarnings("deprecation") @override protected boolean doinbackground(string... arg0) { try { httpclient client = new defaulthttpclient(); httpget request = new httpget("http://testapi.pharmeazy.in/api/medieazy/getallinvoices"); request.addheader("authorization", " basic ndlyawnva2pvawqwm2ptzglrawres09qzgzpamrmnzy0dda4nwp6mzcyohdzmkpjs1m4mta0c2nvctj1otrkazphd0vemzi3mka4wwfzzeu3mji3iubeiypvsfmq"); request.setheader(http.content_type, "application/json"); system.out.println("priinting");

ios - XCode run layout mode -

before ran app , in portrait mode. change in landscape mode ios simulator used hardware->rotate now, don't know have accidentally changed, whenever run app layout "automatically rotates" landscape mode... if choose hardware->rotate doesn't go portrait mode ehm... "really"... rotates 90°!!? what have messed up? how can reset run start in portrait mode? ok, found it! use rotate left multiple times! it cycles through: portrait -> landscape -> landscape vertical -> landscape -> portrait...

Take screenshot when application crashes in Android -

i developing bug reporter in custom rom , want know if there mechanism of taking screenshot when application has crashed. i know handleapplicationcrash() method of actvitymanagerservice called when application crashes. here intent action intent. action_app_error broadcasted contains bug_report . i know bugreportreceiver in frameworks/base/packages/shell gets intent extras extra_bug_report , extra_screenshot . not able trace screenshot generated , intent broadcast. i need in writing code take screenshot automatically when application has crashed. f want save information app crash, must go acra library acra library enabling android application automatically post crash reports google doc form. targeted android applications developers them data applications when crash or behave erroneously. (taken link) a crash reporting feature android apps native since android 2.2 (froyo) available through official android market (and limited data). acra great android develop

ssas - MDX query to pivot table based on condition -

i'm trying write mdx query pivot table. similar query in rdbms this: select stats_date ,isnull(sum(clicks), 0) clicks ,isnull(sum(case when ad_type in (1,3) clicks end), 0) keyword_clicks ,isnull(sum(case when ad_type in (2,3) clicks end), 0) direct_clicks stats_table (nolock) stats_date between '2015-06-01' , '2015-06-30' group stats_date i've 2 dimensions [dim time] & [dim ad type] i've tried below mdx query this: with member [measures].[clicks keyword] iif ( [dim ad type].[ad type].currentmember [dim ad type].[ad type].&[1] ,[measures].[clicks] ,0 ) select { [measures].[clicks] ,[measures].[clicks keyword] } on columns ,{ [dim time].[calendarhierarchy].[date]*[dim ad type].[ad type].[ad type] } on rows [cm_stats_cube] ([dim time].[month].&[201506]:[dim time].[month].&[201

postgresql - SQL update with cursors/loops -

i have 3 sql tables follows: table #1 has column recipeid table #2 has column table #3 has columns recipeid, alimentid, quantity in recipes, want replace occurrences of aliment aliment b. example: recipeid | alimentid | quantity ----------------------------------- recipe | aliment | 10. recipe | aliment b | 5. recipe b | aliment c | 2. recipe b | aliment b | 5. recipe c | aliment | 9. replacing aliment aliment b. expected output: recipeid | alimentid | quantity ----------------------------------- recipe | aliment b | 15. recipe b | aliment c | 2. recipe b | aliment b | 5. recipe c | aliment b | 9. another accepted output keep records quantity equal 0. how in sql without cursor/loops ? there way update-set-select-join ? here, afraid need more set... (i using postgresql.) if understand correctly need select recipeid,replace(alimentid,'aliment a','aliment b') alimentid, sum(quanti

Android Google Maps: How to calculate the distance between the middle of the screen/map and the top of the screen -

i trying calculate distance middle of screen/map(shown) top of screen. have kind of algorithm not sure works properly. getting numbers 6367 , above. here algorithm: double radius = 6367.45; latlngbounds bounds = map.getprojection().getvisibleregion().latlngbounds; latlng center = bounds.getcenter(); latlng north = bounds.northeast; // convert lat or lng decimal degrees radians (divide 57.2958) double centerlat = center.latitude / 57.2958; double centerlong = center.longitude / 57.2958; double northlat = north.latitude / 57.2958; double northlong = north.longitude / 57.2958; // distance = circle radius center top of screen // ma not sure if returns true numbers amm real distance // , call in setoncamerachangelistener on every zoom right? // yes boundradius = radius*(math.acos(math.sin(centerlat) * math.sin(northlat) + math.cos(centerlat)*math.cos(northlat)*math.cos(northlong - centerlong))); am calculating correctly? if

java - Generic Parcelable CircularArray -

i'm implementing generic circular array , make parcelable. able have circular array generic, need pass type in constructor. however, implementing parcelable requires constructor passes parcel . 2 requirements conflicting , can't think of way around this. this attempt, fail on circulararray(parcel in) constructor it's missing type. import android.os.parcel; import android.os.parcelable; import android.util.log; import java.lang.reflect.array; import java.util.arrays; /** * created dav on 08/06/15. */ public class circulararray<t> implements parcelable { public static final int default_size = 10; protected class<t> c; protected final t[] mqueue; protected int curr = 0; protected int n; public circulararray(class<t> c, int n) { this.n = n; this.c = c; mqueue = (t[]) new object[n]; curr = 0; } public circulararray(class<t> c) { this(c, default_size); }

c# - How to validate negative string number -

this question has answer here: how can check if string number? 24 answers i'm doing c# wpf application. may know how validate string value? example "0.00" or "-1.00",etc? because both of them return string retrieve sap, there anyway check? sorry i'm still new c# , not familiar function have in c#. i assume want check if number negative number? double number = 0; if(double.tryparse(mystring,out number)){ if (number > 0) \\do }

android - Use sharedPreference to save account and password -

public class loginactivity extends baseactivity{ private sharedpreferences pref; private sharedpreferences.editor editor; private edittext accountedit; private edittext passwordedit; private button login; private checkbox rememberpass; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login); accountedit =(edittext)findviewbyid(r.id.account); passwordedit = (edittext)findviewbyid(r.id.password); rememberpass=(checkbox)findviewbyid(r.id.remember_pass); login = (button)findviewbyid(r.id.login); editor.putboolean("remember_password",false); boolean isremember = pref.getboolean("remember_password",false); if(isremember){ string account = pref.getstring("account", ""); string password =pref.getstring("password", "");

python - SQLAlchemy unstable behaviour with Oracle -

i've been trying resolve sqlalchemy issue i'm having , narrowed down simple script: #!/usr/bin/env python flask import flask flask.ext.sqlalchemy import sqlalchemy app = flask(__name__) app.config["sqlalchemy_database_uri"] = "oracle+cx_oracle://<user>:<password>@<sid>" db = sqlalchemy(app) class instance(db.model): id = db.column(db.integer, primary_key=true) app.app_context(): instance = db.session.query(instance).filter(instance.id == 105250).first() print(instance) the instance id 105250 indeed exists in database, results i'm getting quite surprising: % x.py <__main__.instance object @ 0x7f65461cdef0> % x.py <__main__.instance object @ 0x7f0c09aa2ef0> % x.py none % x.py <__main__.instance object @ 0x7fd1c7a9eef0> % x.py none can explain how prevent , fix unstable behaviour? i found root cause. posting here, in case runs same issue. the problem caused unstable cx_oracle 5.2.0

vim how to paste multiple lines insert into another multiple lines? -

for example, copy multiple lines a: 'fjalkfjljfllfs' 'dasldkjlasdjla' 'jlfajldjaflajl' they random string same length. i have multiple lines text b , want insert b's same position (not begin or end): 'xxxx fjalkfjljfllfs xxxxx' 'xxxx dasldkjlasdjla xxxxx' 'xxxx jlfajldjaflajl xxxxx' in vim, there way this? if mark lines via blockwise visual mode ( ctrl + v ) , copy them y can put them p .

css - Method to use horizontal columns for a TV Guide? -

Image
i making epg (electronic programme guide) , have basic container set insert columns show channels. have read online methods use i'm not sure. 1 of ones thinking using bootstrap framework. i trying make this. big container horizontal rows in! advice appreciated thank you! you might want use grid if you're using bootstrap. following. <div class="container"> <div class="row"> <div class="col-sm-1></div> <div class="col-sm-3> <div>some content</div> <div> <div class="col-sm-4> <div>some content</div> </div> <div class="col-sm-2> <div>some content</div> </div> </div> though way of formatting layout of page. given guide image dynamic isn't ideal.

Pixel values differ between opencv and matlab -

when displaying pixel values of image (a rgb image converted grayscale) using "display" function in matlab, found pixel values less 1 (all values between 0 , 1). whereas when same in opencv, getting higher values. why change in values happen ? open cv code , matlab code follows: for (int = 0; < img1.rows; i++) { (int j = 0; j < img1.cols; j++) { cout << (unsigned int)img1.at<uchar>(i, j) << endl; } } matlab code: gi=rgb2gray(i); imshow(gi); sorry disappoint you. no 1 guarantees conversion of rgb gray-scale yield same result. there 2 reasons the conversion not mathematical correct formula rather subjective issue. on course of last 50 years few different standards (mainly color television supporting greyscale signals) written of how convert rgb gray level. different standards lead identical visible results, though actual values of pixels differ bit (~roughly 0.2%). can read more standards in wikipedia. example: 1

sorting - How to sort Culture Specific DataTime Column in a datatable(jquery) which has empty columns too -

i working on mvc , using datatable has column of type datetime. column has few blank( empty) cells too. achiving using string property fill column instead of datetime property. also, date should culture-specific html code: <tbody> @foreach (var item in model.xyz) { <tr> <td> @item.accountname </td> <td> @item.accountid </td> <td> @if (item.lastlogindate.equals(datetime.minvalue)) { <text>@item.slastlogindate</text> } else { //this customculture value : //cultureinfo customculture = new cultureinfo("some culture"); <text>@item.lastlogindate.tost