Posts

Showing posts from August, 2015

java - Handle Exception with error dialog in asynctask -

i making rss android app pull reload. want use asynctask. here code: class refresh extends asynctask<string,void,void>{ @override protected void doinbackground(string... params) { try { download(getresources().getstring(r.string.link)); }catch (exception e){ createneterrordialog(); } return null; } @override protected void onpostexecute(void avoid) { super.onpostexecute(avoid); try{ views(); }catch (exception e){ toast.maketext(mainactivity.this, "error", toast.length_long).show(); cancel(true); } lstpost.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { intent intent = new intent(mainac

Convert string to directory object in PowerShell -

i read strings line line file (using get-content , foreach loop), want convert strings directory objects (so can access properties .fullname ). how convert string directory? with files easy: $myfileasfile = $myfileasstr | dir $_ , however, how obtain goal $directoryasstring ? okay, answer seems get-item : $dirasstr = '.\documents' $dirasdir = get-item $dirasstr echo $dirasdir.fullname works!

php - how to switch between two form for website visitor once admin logged in wordpress -

i facing problem: have 2 forms form1 , form2 now. want achive once admin logged in anywhere visitor (non logged in) wordpress site should see form1 on page. else, should see form2? did below: if(current_user_can('author' )|| current_user_can('administrator')) { show form1 } else { show form2 } now, works fine admin screen not other user or visitor. want universal. thanks in advance. using code in custom page template. please me, guys. tutorial me or if there other way achieve this. please suggest me. to achieve have register admins logging in or out somewhere. use transient keep eye on whos logging in, , registering if admin (someone capable of managing settings). the following not tested, should work. past of functions.php , or create plugin it: //this function checks logging in, , adds database if admin. add_action('wp', 'update_online_users_status'); //registeres function funct

Python: Selenium send_key not working -

i trying use selenium in python, as beginner in doing cannot send_key work, straight forward , missting something. here example of have done far: from selenium import webdriver driver = webdriver.firefox() driver.get("https://semantria.com/demo") item = driver.find_element_by_id("analyze_url_form") item.send_keys("http://finance.yahoo.com/news/skystar-bio-pharmaceutical-company-provides-133000048.html") go_button = driver.find_element_by_id("analyze_url_button") go_button.click() the idea in https://semantria.com/demo website, there empty space 1 can enter website link, , click on go button. however, looks code not this. am doing wrong? website should aware of , change code accordingly? on appreciated. the problem sending keys form element, not input element inside. plus, can send url new line @ end same you've entered url , pressed enter key results in form being submitted. works me: item = driver.find_element

python - How to Properly Use Arithmetic Operators Inside Comprehensions? -

i dealing simple csv file contains 3 columns , 3 rows containing numeric data. csv data file looks following: col1,col2,col3 1,2,3 2,2,3 3,2,3 4,2,3 i have hard time figuring out how let python program subtracts average value of first column "col1" each value in same column. illustration output should give following values 'col1': 1 - 2.5 = -1.5 2 - 2.5 = -0.5 3 - 2.5 = 0.5 4 - 2.5 = 1.5 here attempt gives me (typeerror: unsupported operand type(s) -: 'str' , 'float' ) @ last print statement containing comprehension. import csv # opening csv file file1 = csv.dictreader(open('columns.csv')) file2 = csv.dictreader(open('columns.csv')) # calculations numofsamples = open('columns.csv').read().count('\n') sumdata = sum(float(row['col1']) row in file1) aver = sumdata/(numofsamples - 1) # compute average of data in 'col1' # subtracting average each value in 'col1' data = [] ro

python - Finding out presence of loops(interconnections) in a line -

i have set of 2d coordinates. can positive, negative , in fractions well. points like, 50.2345,-23.452 1.345,-14.206 so on , forth. question if plot these coordinates on graph, how determine whether line intersect form loop or remain zig zag line(without intersecting itself). this can calculated nested loop. assume have 5 points: [0,0],[1,1],[2,1],[2,0],[0,1] this gives 4 edges, last of overlap first. edge ([0,0],[1,1]) intersect edge ([2,0],[0,1]). iterate on each edge (line segment) , test intersection other line segments. pseudocode: for(edge1 in edges) { for(edge2 in edges) { if ( testintersect(edge1,edge2) ) return true; } } return false;

java - What is the best way to insert Spring Security into a project? I have 2 differents way to do it -

i pretty new in spring security , have doubts related these 2 different configurations found in 2 different projects. want understand 1 better other or if these equivalent. project 1: spring-security.xml of project 1: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <security:http> <security:intercept-url pattern="/springlogin" access="permitall"/> <security:intercept-url pattern="/dospringlogin" access="permit

precision - Can't get my chrono to count more often than once a ms -

i'm trying code measure time durations shorter 1ms can't. i've searched around have not managed understand how it. i've added various bits of code found think relevant. template <class clock> void display_precision() { typedef std::chrono::duration<double, std::nano> ns; ns ns = typename clock::duration(1); std::cout << ns.count() << " ns\n"; } int main() { display_precision<std::chrono::high_resolution_clock>(); display_precision<std::chrono::system_clock>(); display_precision<std::chrono::steady_clock>(); std::cout << std::chrono::high_resolution_clock::period::num << "/" << std::chrono::high_resolution_clock::period::den; std::chrono::high_resolution_clock::time_point nowtime; std::chrono::high_resolution_clock::time_point starttime; starttime = std::chrono::high_resolution_clock::now(); int count = 0; { n

How can I pop an element from a Set in Ruby? -

in python can a_set.pop() , remove element set , catch in variable. there way same thing set in ruby? the best way research question @ docs. google search 'ruby set' find doc ruby set class . can review of available instance methods. as can see, set "a collection of unordered values no duplicates." since it's unordered, it's not designed values @ particular locations within set, including last value. you convert array using #to_a , use #pop on array, since order of set not guaranteed, might not end value you're expecting. edit: interestingly, pop in python deletes , returns "an arbitrary element." see that's looking for. while not available built-in method in ruby set, suppose implement using array#sample , grabs random element array, , delete set: class set def pop el = self.to_a.sample self.delete(el) el end end

eval - R lazy evaluation of two variables in data.frame -

given data frame df <- data.frame(a = sample(c(1,0), 30, replace = true), b = sample(c(2,3), 30, replace = true), c = sample(c(4,5), 30, replace = true)) and expression captured lazy() argument in lazyeval package library(lazyeval) toeval <- lazy(c(a,b)) i want data frame 2 variables , b instead of 1 concatenated vector, given with result <- lazy_eval(toeval, df) an unelegant version instantly comes ones mind df_result <- data.frame(a = result[1:(nrow(df))], b = result[(nrow(df)+1):(nrow(df)*2)]) better ideas appreciated! you can try: toeval <- lazy(list(a,b)) data.frame(do.call(cbind, lazy_eval(toeval, df)))

java - UcanaccessSQLException: UCAExc:::3.0.1 data type of expression is not boolean -

Image
i have table following image i need english words kurdish word contains "بةرز", cant use select english table1 kurdish '%بةرز%'; because accepts words sub-string in word these ،يبلبةرز ، سيس بةرز , , when try use regular expression in query: query = "select english table1 kurdish regexp '^[.، ]*("+"بةرز" +")[ ،.]*$'"; s.execute(query); it shows following exception net.ucanaccess.jdbc.ucanaccesssqlexception: ucaexc:::3.0.1 data type of expression not boolean is problem regular expression or what? note i'am using ucanaccess database connection instead of columnname regexp 'pattern' i believe need use regexp_matches(columnname, 'pattern') this seems work me ... string targetstring = "بةرز"; try (preparedstatement ps = conn.preparestatement( "select english table1 " + "where kurdish = ? " + "or regexp_matches(

html - Container with justified text-align in IE -

i have 3 divs have fixed widths. goal align these 3 divs horizontally equal spacing between each. have found best solution far use container "text-align: justify" seen in tutorial: http://www.barrelny.com/blog/text-align-justify-and-rwd/ . this method place equal space between 3 divs, regardless of other factors. i've used technique , feel far superior using floats. problem, however, doesn't appear working in ie 11 , down. i minimize html, put "&nbsp" between each div: <div class="block-container"> <div class="block"></div>&nbsp; <div class="block"></div>&nbsp; <div class="block"></div> </div> the "block-container" has these styles applied make work: max-width: 1100px; text-align: justify; &:after{ content: ''; display: inline-block; width: 100%; height: 0; font-size:0; line-height:0; }

testing - How to see closed bugs in Microsoft test manager -

i not see closed bugs in microsoft test manager. showing active bugs.in filter other state of bug not listing select . there option manage filter in verify bugs tab, you can edit default filters reflect desire: 1- open microsoft test manager -> test -> verify bugs 2- select view -> filter -> edit (filter name) 3- change clauses add "closed bugs"

uiimageview - Swift: Remove All from the Subview -

i create multiple objects under same name , adding them subview (variables in german). wandx = (screenbreite - ((felderanzx - 0) * feldbreite)) wandy = ( screenhoehe - ((felderanzy - 5) * feldbreite)) for(var = 0; < 6; i++){ wand1 = uiimageview(frame: cgrectmake(wandx, wandy, feldbreite, feldbreite)) wand1.image = wand self.addsubview(wand1) wandxarray.insert(wandx, atindex: i) wandyarray.insert(wandy, atindex: i) wandx = wandx + feldbreite } (creating row of walls) but if want remove them wand1.removefromsuperview() removes last object added. possible solution found putting object on top , delete references. many object , many stages problem cpu usage. edit: using method self.view.subviews.removeall() is getting me following error: cannot use mutating member on immutable value: 'subviews' get-only property wand1 = uiimageview(... rewriting reference on , over, never able remove last

Python function: Error with overtime while creating a wage function -

i trying create wage function using python 3.50 goes follows: user enters hourly pay "x", , hours worked "y". trying implement overtime portion if hours worked greater 40 person paid 1.5 times more hours. inputting wage (10,45) , returning 525 when should returning 475, can me pick out error? appreciated, thank time in advance. def wage(x, y): if y > 40: ehours = y - 40 overtime = x * 1.5 * ehours return x * y + overtime else: return x * y well, should paid 0.5 (not 1.5 extra), code should this: def wage(x, y): if y > 40: ehours = y - 40 overtime = x * 0.5 * ehours return x * y + overtime else: return x * y alternatively, might easier (but not better) this: def wage(x, y): return x * y + (0.5*x*max(y-40, 0))

sql server - Visual Studio 2013 database project - deployment / publishing - filegroup PRIMARY -

traditionally have created simple databases using sql server management studio, taken backup , restored empty database online. preferred way of hosting server. i started using visual studio 2013 database project options because prefer environment. used http://sanderstechnology.com/2013/schema-modelling-with-visual-studio-2013-preview/12336/#.vijncnkfo71 guide. there differences - don't have post deploy scripts option have created databases using publish seems fine. there 1 quirk differs in examples i've looked at. when publish, creates database name chose , appends _primary . in database properties shows database name above shows filegroup = primary , i'm assuming why? when view db via vs2013 or sql server management studio, shows db name if want attach db project have attach _primary.mdf file. in ignorance assuming _primary wrapper around database? wondering why vs2013 , if deploying way do, explained above, going cause issues? or doing wrong.. the da

c# - Outer Glow Effect for Text in a Custom Control -

Image
how apply outer glow on text of label in c# winforms, , blur effect. using custom control as see, custom panel , i'm trying glow effect entire text. protected override void onpaint(painteventargs pe) { //base.onpaint(pe); stringformat sf = new stringformat(); sf.alignment = stringalignment.center; sf.linealignment = stringalignment.center; graphicspath gp = new graphicspath(); gp.fillmode = fillmode.alternate; gp.addstring(this.text, this.font.fontfamily, 2, 12f, new point(clientrectangle.x+text.length*4-20, clientrectangle.y+10), sf); // in border using (solidbrush brush = new solidbrush(backcolor)) pe.graphics.fillrectangle(brush, clientrectangle); pe.graphics.drawrectangle(new pen(color.fromargb(_innerbordercolor.r, _innerbordercolor.b, _innerbordercolor.g), 1.0f), 0, 0, clientsize.width - 2, clientsize.height - 2); pe.graphics.drawpath(new pen(color.blue, 2f), gp); pe.graphics.drawstring(base.text, this.font,

JavaScript Function working well on Firefox but not Chrome -

i have javascript function changes color of nav bar on click of button. used validator , returned no errors.i used validator on both browsers. here part of code, suggestions appreciated. <body class ="backgroundtwo"> <h1 class ="centered sansserif background" >hello world!</h1> <div> <ul class ="center"> <li class ="center"><a id="demo" class ="center" href="about.html" >about site</a></li> <li class ="center"><a id ="demo2" class="center" href="current.html">current work</a></li> <li class ="center"><a id ="demo3" class="center" href="http://www.dallascowboys.com/">cowboys</a><li> </ul> </div> <h1 class = &

android - Droid 9-patch Splash is black on some devices -

i'm using 9-patch place logo on splash screen. works on test devices, on simulators, on 1 particular device – sm-t230 – shows this: image of splash screen space under logo turned black (logo deliberately blurred) i created 9-patch dpis (ldpi, hdpi, ...). it appear scaling it; size (in raw pixels) halfway between size of mdpi , hdpi images. any thoughts? i believe solved adding pixel margin around content of image.

angularjs - Can't get ng-show to work with ng-repeat -

i'm trying ng-show working reason, won't. have tried following methods: <div ng-show="s_quest.title > 0">similar questions</div> <div ng-show="s_quest.title">similar questions</div> <div ng-show="!s_quest.title">similar questions</div> <div ng-show="s_quests">similar questions</div> this code below shows when similar questions called. <span ng-repeat="s_quest in s_quests track $index"> <span class="fullpadding"> <a href="{{ques_cat_enum[quest.quest_cat]+'/'+s_quest.slug}}"> <span>{{s_quest.title}}</span> </a> </span> <br /> </span> where tink i'm going wrong? i ended using code worked: <div ng-show="s_quests > 0">similar questions</div> thank you, time :)

C user input only integers, return value from scanf -

i trying user input, , want make sure enter integers, , if don't ask them type again (loop until right). i have found lot of different approaches this; more complicated others. found approach seems work. but don't why tested in code: scanf("%d%c", &num, &term) != 2 i can understand scanf outputs number of items matched , assigned, don't why outputs 2 if integer. the code in c is: int main(void) { int num; char term; if (scanf("%d%c", &num, &term) != 2 || term != '\n') printf("failure\n"); else printf("valid integer followed enter key\n"); } trying put in loop: int main(void){ int m, n, dis; char m_check, n_check, dis_check; do{ m = 0; n = 0; dis = 0; m_check = ' '; n_check = ' '; dis_check = ' '; printf("please enter number of rows m in matrix (integer): "); if(scanf("%d%c", &m, &m_check) !=2 ||

Combining multiple dataframe in R -

i have 5 dataframe ( df1 , df2 , df3 , df4 , df5 ). have same columns , column names (nir database). frist combine df1 , df2 df12 , df3 , df4 , df5 df345 , combine df12 , df345 df . (it has 2 stages). df12 <- do.call(rbind, list(df1,df2)) df345 <- do.call(rbind, list(df3,df4,df5)) df <- do.call(rbind, list(df12,df345)) newdf <- data.frame(oiltype="olive",nir=df[2:276]); with got 1 of column names become nir.nir.v4 while need nir.v4 . i think due use of list. know if there's alternative combine multiple dataframes without having face trouble. appreciate suggestion. i have 5 data.frame df1, df2, df3, df4, df5 having same columns , column names. > df1 sepal.length sepal.width petal.length petal.width species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa > df2 sepal.length sepal.width

Android Studio: Rendering Problems Missing styles-correct theme chosen for this layout, Failed to find style with id -

Image
i want create card item xml layout cardview , getting error. common solutions here not worked (tried them , others similar posts). this xml : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" card_view:cardcornerradius="3dp" card_view:cardelevation="4dp"> </android.support.v7.widget.cardview> </relativelayout> this relevant part of styles.xml : <!-- base application theme. --> <style name="apptheme" parent="

matlab - How to use trained neural network to predict future values of time series? -

i have been using neural network toolbox (matlab) time series prediction. have followed every step given in manual , have got "net" network. my input had 1344 values, output has 1340 values (because of delay 4). question how know 1341th value , on using trained neural network? this might help net = newff(observations,targets,10); [net,tr] = train(net,observations',targets'); erg = zeros(size(test_mat,1),1); = 1: size(test_mat,1) y = sim(net,test_mat(i,:)'); erg(i)=find(compet(y)); end where observations training set targets known values of hindcast , test_mat values forecast. in erg predictions forecast stored.

c# - Authenticating with a non-compliant SMTP server -

i'm supposed send e-mail through smtp server. smtp server requires authentication. however, if use default authentication mechanism of .net smtpclient, authentication fails 504 unrecognized authentication type . when using putty i'm able authenticate: 250 auth login plain auth login 334 vxnlcm5hbwu6 base64 encoded username 334 ugfzc3dvcmq6 base64 encoded password 235 authentication successful the smtpclient using different approach, username passed in auth login command: 250 auth login plain auth login base64 encoded username 504 unrecognized authentication mail from: ... it seems ignoring 504, because sending mail command. reading sources on internet , allowed send username auth login command: however, there exists different, rfc compliant version of behavior, client sends userid auth login method the problem @ smtp server's side, have no control on it. is possible make smtpclient send commands separately? sample code using (var client = new

How can i know if a sorted vector has duplicate values or not in C++ -

i don't want change vector or create new vector duplicates removed. want check duplicates, like: {90, 80, 70, 60, 50, 40, 30, 20, 10, 10} -> true {90, 89, 88, 87, 86, 85, 84, 83, 82, 81} -> false since vector sorted, can check if 2 adjacent elements equals : for (auto = vec.begin() + 1; != vec.end(); ++it) { if (vec[it] == vec[it - 1]) { // duplicate return true; } } // no duplicate return false; you use std::adjacent_find returns iterator first element of first duplicate in vector: auto = std::adjacent_find(vec.begin(), vec.end()); if (it == vec.end()) { // no duplicate return false; } // duplicate return true;

javascript - Corrupted download in AngularJs app -

i trying download file using filesaver.js , corrupted file whenever hit download button. app backed php rest service, , using curl command line confirms rest working ok. here last version of pseudo-code use downloading: // let str data received $http promise // code run in "then" callback var arr= new uint8array(str.length); for(var i=0; i<str.length; i++) { arr[b]=str.charcodeat(i); }; var blob = new blob([arr], {type: 'application/octet-stream'}); saveas(blob, "afilename"); it corrupts file. i tried without applying uint8array , , giving str directly blob . guessed, failed too. i writing server , client myself, can change in them. thing want handle downloads client-side, , can't redirect users file url download it, because rest needs authentication , token lives within angular app. not choice change server handle file downloads without authentication. the rest has urls /files/:id when accessed, gives file content regular htt

javascript - Async AJAX call not working with when and then -

i have following code: function accesscontrol(userid) { return $.ajax({ url: "userwidgets", type: "get", datatype: 'json', data: { userid: userid } }); }; var userwidgets = accesscontrol('1'); $.when(userwidgets).then(function (data) { alert(data); }); i don't want make function sync adding parameter async: false , alert isn't appearing @ all, there wrong in code? should use approach? $.ajax returns promise. so, don't need wrapped in $.when again. use then directly on userwidgets ajax instance. userwidgets.then(function (data) { alert(data); }, function(e, status, error) { console.log(error); // debugging }); from jquery docs jqxhr.then(function( data, textstatus, jqxhr ) {}, function( jqxhr, textstatus, errorthrown ) {}); incorporates functionality of .done() , .fail() methods, allowing (as of jquery 1.8) underlying promi

database - how to understand experiment performance for partition databse -

Image
i studying paper fast distributed transactions partitioned database systems , found paragraph did not understand. difference between node /machine /partition , meaning of dist warehouse? figure 4 shows total , per-machine throughput (tpc-c new order transactions executed per second) function of number of calvin nodes, each of stores database partition containing 10 tpc-c warehouses. investigate calvin’s handling of distributed transactions, multi-warehouse new order transactions (about 10% of total new order transactions) access second warehouse not on same machine first. because each partition contains 10 warehouses , new order updates 1 of 10 “districts” warehouse, @ 100 new order transactions can executing concurrently @ machine (since there no more 100 unique districts per partition,

python 3.x - Regex repeating substring -

i trying simple true/false test see if string matches regular expression: import re sentence = "eee" if sentence == r"e*": print(true) else: print(false) how can come true? try following: import re sentence = "eee" matches = sentence.match("e") !== "none" if matches: print(true) else: print(false) the .match method returns "none" if regex not match. variable matches returns true or false according if matched.

c++ - Algorithm to assemble a simplified jigsaw puzzle where all edges are identified -

are there kind of algorithms out there can assist , accelerate in construction of jigsaw puzzle edges identified , each edge guaranteed fit 1 other edge (or no edges if piece corner or border piece)? i've got data set here represented following structure: struct tile { int a, b, c, d; }; tile[some_large_number] = ...; each side (a, b, c, , d) uniquely indexed within puzzle 1 other tile match edge (if edge has match, since corner , border tiles might not). unfortunately there no guarantees past that. order of tiles within array random, guarantee they're indexed 0 some_large_number. likewise, side uids randomized well. fall within contiguous range (where max of range depends on number of tiles , dimensions of completed puzzle), that's it. i'm trying assemble puzzle in efficient way possible, can address completed puzzle using rows , columns through 2 dimensional array. how should go doing this? the tile[] data defines undirected graph each nod

ruby on rails - Foreign key does not exist when deleting dependent records -

i have 2 models. first one: class keyword < activerecord::base has_many :words, dependent: :delete_all end the second: class word < activerecord::base end my migrations: class keywords < activerecord::migration def change create_table :keywords |t| t.string :name, null: false, unique: true t.string :description, null: false t.string :keys, null: false t.timestamps null: false end end end and words: class words < activerecord::migration def change create_table :words |t| t.belongs_to :keyword t.string :name, null: false t.timestamps null: false end end end when i'm trying delete keywords instance rails throws out following exception: pg::undefinedcolumn: error: column words.keyword_id not exist line 1: delete "words" "words"."keyword_id" = $1 ^ : delete "words" "words"."keyword_id" = $1 so question is, why rails creat

javascript - How does 'function1(data, function2)' work? -

how these code work ? function output(a) { console.log( "the function filter return " + + "!"); } x = function(data, fun) { = data; fun(a); }; theinput = " text input "; x(theinput, output);//the function filter return text input ! i wrote mysels , , works fine . don't understand how 'function1(data, function2)' run . what x ? it variable holds reference function 2 parameters, data , fun . whats doing here? x(theinput, output); you call function passing string , function. yes, functions in javascript can treated other object. actually, objects. can stored variables (store reference them), can passed arguments function etc. what happening inside body of function stored in x ? initially, assign data variable called a , pass argument function output . function stored in output called. if there 1 takeaway code snippet fact passed function argument function. important in javascript , associate

ios - Why my fabric plugin blank after distribute new build? -

Image
i got below result after distributing new build xcode, i don't blank before updating fabric io. there used alert label if either succeed uploading new build or failed uploading new build. cant know if new build distributed or not blank. please me. thanks i've got same issue few days ago , here how solved it: ** uninstaller mac (here free 1 http://www.freemacsoft.net/appcleaner/ ) , use remove fabric completely. empty trash restart mac remove fabric xcode project removing build script , frameworks. may need comment code depending on setup. clean/build, fix errors if any. download latest fabric , install follow instruction setup project again, (e.g. adding build script) ** make sure uninstaller choose deletes every , related files fabric. shows list of files it's delete.

Netbeans does not recognize Flex CSS3 property -

Image
i'm using netbeans 8.0.2 , i'm on wordpres project. autocompletion of css not active on ide, flex property. how solve it?

ftp - php Failed to open stream error for some users but not others -

i've been searching stackexchange topics on error not have found mirror i'm experiencing. my current state have web page contains visualization set d3.js of objects clickable. upon clicking on 1 of them, php script executed via ajax (with variables passed base on object clicked) query run mssql database returns list of images retrieved via ftp. far know part working. the code hosted on win 2008 r2 server running iis. after retrieving array of images, loop executed see if have been downloaded and, if not, image fetched via ftp in loop below: if(in_array($filename,$files)) { //*** see if image has been ftp'd $fileto = "c:/inetpub/wwwroot/iris/images/" . $filename; } else { $ftp_host = $wrow["serverid"] . ".prod.com"; // *** create ftp object $ftpobj = new ftpclient(); // *** connect try{ $ftpobj->connect($ftp_host

python - getsizeof returns the same value for seemingly different lists -

i have following 2 dimensional bitmap: num = 521 arr = [i == '1' in bin(num)[2:].zfill(n*n)] board = [arr[n*i:n*i+n] in xrange(n)] just curiosity wanted check how more space take, if have integers instead of booleans. checked current size sys.getsizeof(board) , got 104 after modified arr = [int(i) in bin(num)[2:].zfill(n*n)] , still got 104 then decided see how strings: arr = [i in bin(num)[2:].zfill(n*n)] , still shows 104 this looks strange, because expected list of lists of strings waste way more memory booleans. apparently missing how getsizeof calculates size. can explain me why such results. p.s. zehnpard's answer, see can use sum(sys.getsizeof(i) line in board in line) approximately count memory (most not count lists, not important me). see difference in numbers string , int/bool (no difference int , boolean) the docs sys module since python 3.4 pretty explicit: only memory consumption directly attributed object accounted for,

java - How to mask the HSQL password -

i have created batch file connect hsql database, here when entered password connect database appears clear text we cannot specify non-empty password argument. prompted password part of login process.but appears while password being entered, appears clear text , typed! want mask password, should appear ***. my batch file: java -jar sqltool.jar --inlinerc=url=jdbc:hsqldb:hsql://localhost:8888/xx,user=ddd java provides console class basic terminal io, including not displaying passwords user inputs via readpassword() : reads password or passphrase console echoing disabled this not secure in way - password still entered cleartext - if intent avoid password being seen on screen it's entered, correct mechanism.

php - Logic for all possible scenarios paypal IPN -

okay i'm writing ipn page, got work inserting db when payment_status completed. here query far: if($payment_status=="completed"){ $txn_id_check = $mysqli->query("select `transaction_id` `payment` `transaction_id`='$txn_id'"); if($txn_id_check->num_rows != 1) { $query = "insert `payment` (`transaction_id`, `payment_status`, `users_id`) values(?, ?, ?)"; $statement = $mysqli->prepare($query); $statement->bind_param('ssi',$txn_id, $payment_status, $id); if($statement->execute()){ print 'success! id of last inserted record : ' .$statement->insert_id .'<br />'; }else{ die('error : ('. $mysqli->errno .') '. $mysqli->error); } $statement->close(); } } because i

java - GL_INVALID_VALUE from GLUtils.texImage2D -

i'm trying develop small game android using opengles2.0, , have issue stops me achieving compatibility between devices. i'm testing app in 2 devices, xperia z1 , galaxy s2 (as emulator not work opengles2.0). if call glutils.teximage2d load texture bitmap came image of resolution lower or equal 1024x1024 works fine in both devices. using texture of 2048x2048 works on s2, no longer on z1 (it returns gl_invalid_value ). loading higher not work in z1, nor in s2. however, checked gl_max_texture_size , , in both devices set 4096. not know wrong, call teximage2d follows: gles20.glgentextures(1,texture,0); bitmap bmp = bitmapfactory.decoderesource(mcontext.getresources(), r.drawable.test); gles20.glactivetexture(gles20.gl_texture0); gles20.glbindtexture(gles20.gl_texture_2d, texture[0]); gles20.gltexparameteri(gles20.gl_texture_2d, gles20.gl_texture_min_filter, gles20.gl_linear); gles20.gltexparameteri(gles20.gl_texture_2d, gles20.gl_texture_mag_filter, gles20.gl_linear); glutil

VAST/VPAID tag ssp -

i have vast/vpaid tag. according documentation http://www.iab.net/media/file/openrtbapispecificationversion2_2.pdf type of tag indicates video object in line 'api'. if in bid request 'api' empty. how know player supports vpaid? reply. the answer simple, ssp not support vpaid.

angularjs - Angular: Module was created but never loaded -

i have trying fix not able find solution since long time. angular newbie , trying make website home angular app. angular app has controller , 2-3 directives. in head section of page have: home.cshtml: <head> //some other stuff.... <script src="/scripts/angular.min.js" type="text/javascript"></script> <script src="/scripts/myapp.js" type="text/javascript"></script> </head> <body ng-app="myapp"> <div ng-controller="homecontroller"> <page-tile-grid></page-tile-grid> </div> </body> and myapp.js has var myapp= angular.module('myapp', []) .controller("homecontroller", function($scope){......}) .directive('page-tile-grid', function () {....}) .directive('page-tiles', function () {....}) .directive('page-tile-info',

python - Django Email Error: raise err socket.error: [Errno 111] Connection refused -

i saw question being asked @ number of places no solutions have worked me far, or may unable understand (newbie traits). please if can. email settings/ settings.py: email_backend = 'django.core.mail.backends.smtp.emailbackend' email_use_tls = true email_host_user = 'xyz@gmail.com' email_host_password = 'pwd' email_host = 'smtp.gmail.com' email_port = 587 error receiving while sending test email django python shell: first ran send mail command - gave me error1: django.core.exceptions.improperlyconfigured: >>> django.core.mail import send_mail >>> send_mail('test', 'test', 'xyz@gmail.com', ['abc@hotmail.com'], fail_silently=false) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/django_admin1/venv-tile-prod/lib/python2.7/site- packages/django-1.8.2-py2.7.egg/django/core/mail/__init__.py", line 56, in send_mail fail_silently=fa

mysql - Probleme white UPDATE and IF (Select) -

with mysql i've tried : update modepaiement set emplacement = if((select emplacement escompte emplacement = 4) or (select emplacement modepaiement emplacement = 4), 13, 11) id = 1 but receive error can't use modepaiement in select part... if replace modepaiement other table work fine... maybe because update in modepaiement table... is there way ? http://sqlfiddle.com/#!9/2c710e/1 update modepaiement left join (select emplacement modepaiement emplacement = 4 union select emplacement escompte emplacement = 4) t on 1 set modepaiement.emplacement = if(t.emplacement null,11,13) id = 1

prototype - Why doesn't my JavaScript constructor pattern work? -

why doesn't javascript pattern work? example try call function this.prepare.build() , doesn't works. gives me error: this.prepare.build not function <script> $(function () { new $.myfunction(); }); </script> <script> (function($) { 'use strict'; function myfunction(options) { return new myfunction.prototype.init(options); } myfunction.fn = $.myfunction.prototype = { init: function() { console.log('call: myfunction.init') this.prepare.build(); }, prepare: function() { return { build: function() { console.log('call: myfunction.prepare.build'); }, run: function() { console.log('call: myfunction.prepare.run'); } } } } inviter.prototype.init.prototype = inviter.prototype; })(jquery); </s

javascript - How can I use TypeScript compiler through nodejs? -

i have sample code , saved file such hello.ts after installing nodejs on windows use below command installing typescript npm install -g typescript how can compile hello.ts node.js directly? when install "typescript 1.6 in vs2015" , use tsc.exe don't have problem want use node.js instead of vs 2015 extension please guide me generate .js , .ds through node.js please guide me generate .js , .ds through node.js you have 2 options: run tsc.js node script use typescript npm module run node tsc.js this approach taken tools e.g grunt-ts . call spawn on current process process.execpath passing in other commands args ( -d ). one sample run typescript node module if playing typescript compiler api highly recommend ntypescript see readme reasons . the typescript compiler provides simple function called transpile can use expected output , write out disk yourself. ps: have docs on typescript compiler internals here : https://basara