Posts

Showing posts from May, 2014

performance - PHP looping through huge text file is very slow, can you improve? -

the data contained in text file (actually .dat) looks like: lin*1234*up*abcde*33*0*ea lin*5678*up*fghij*33*0*ea lin*9101*up*klmno*33*23*ea there on 500,000 such lines in file. this i'm using now: //retrieve file once $file = file_get_contents('/data.dat'); $file = explode('lin', $file); ...some code foreach ($list $item) { //an array containing 10 items foreach($file $line) { //checking if these items on huge list $info = explode('*', $line); if ($line[3] == $item[0]) { ...do stuff... break; //stop checking if found } } } the problem runs way slow - 1.5 seconds of each iteration. separately confirmed not '...do stuff...' impacting speed. rather, search correct item. how can speed up? thank you. if each item on own line, instead of loading whole thing in memory, might better use fgets() instead: $f = fopen('tex

java - Should i nullify an interrupted thread? -

i created thread this: private thread t = new thread() { @override public void run() { try { while(true) { // work thread.sleep(1000); } } catch (interruptedexception ex) { } } }; t.start(); then interrupted using t.interrupt() . as thread stops , on sleep() interrupt , become unusable, stay on memory? do have call t = null , or gc take care of that? i'm trying dynamically interrupt thread , recreate when needed (using t = new thread() ), im not sure if interrupt() removes old thread memory. i've searched couldn't find specfic answer. the thread class proxy os thread. before call start() there no actual os thread , after thread stops cleaned if hold on thread object. @ point other object , cleaned in normal way.

parse.com - Android Activity isn't getting started from Parse Notification -

i'm having odd problem parse notifications on android. it occurs in situation application isn't running, notification received , application started. first notification correctly start default push callback activity subsequent notifications not start activity! making notifications impossible detect. when application started it's icon callback activities correctly started , see oncreate function called. when started icon fails. i've correctly added permissions , application manifest additions. i've specified following class application initialises parse api , sets callback. package com.distriqt.example.test; import android.app.application; import com.parse.parse; import com.parse.parseinstallation; import com.parse.pushservice; public class mainapplication extends application { public static string parse_application_id = "xxxx"; public static string parse_client_key = "yyyy"; @override public void oncreate()

wordpress - css is showing two times in browser -

i using wordpress , when inspecting element through firebug css rules repeating .repeating rules having same rules , same page no same style .i don't know issue . can body me solve . css in fire bug #nav ul li { appkara/style.css?ver=2013-07-18(line 44) color: #666666; display: block; font: 400 14px 'open sans',sans-serif; padding: 19px; } #nav ul li { appkara/style.css?ver=1.0.0(line 44) color: #666666; display: block; font: 400 14px 'open sans',sans-serif; padding: 19px; } it seems cache issue. may loading exact same css file- “style.css” -twice. “?ver=…“ called query string , does’t css file - allows wordpress or browser know if there’s change css file can refresh/change cache. first, try clearing cache locally. if doesn’t work try clearing cache in wordpress (it may plugin installed).

Why aren't the C-supplied integer types good enough for basically any project? -

i'm more of sysadmin programmer. spend inordinate amount of time grovelling through programmers' code trying figure out went wrong. , disturbing amount of that time spent dealing problems when programmer expected 1 definition of __u_ll_int32_t or whatever (yes, know that's not real), either expected file defining type somewhere other is, or (and far worse thankfully rare) expected semantics of definition other is. as understand c, deliberately doesn't make width definitions integer types (and thing), instead gives programmer char , short , int , long , , long long , in signed , unsigned glory, defined minima implementation (hopefully) meets. furthermore, gives programmer various macros implementation must provide tell things width of char, largest unsigned long, etc. , yet first thing non-trivial c project seems either import or invent set of types give them explicitly 8, 16, 32, , 64 bit integers. means sysadmin, have have definition files in place programmer ex

javascript - Issue with grid position in jquery mobile? -

Image
i using grid view , need grid view @ center of screen, how can that? css: .grid-container { margin-left: auto; margin-right: auto; width: 302px; height: 452px; } .grid-row { width: 302px; height: 150px; margin-bottom: 1px; } .grid-row_last-child { margin-bottom: 0px; } .grid-row { position:relative; float: left; display: block; width: 100px; height: 150px; margin-right: 1px; } .grid-row a:last-child { margin-right: 0px; } html: <div class="grid-container"> <div class="grid-row"> <a href="index.htm"> <img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_weitat.jpg" /> </a> </div>

c++: Load a .dll to new process -

we've plugin based application. each plugin exported dynamic library. due reasons have run each plugin new process ( separate executable each plugin required ). so, tring export .dll new process. each plugin contains constructor, destructor , functions. without exporting works in way ( simplified code ): hinstance lib = loadlibrary(boost_path_to_dll); // load plugin class interface library using factory functions typedef fooclass *(*createpluginfuncdef)(); // pointer constructor inside of plugin createpluginfuncdef createptr = (createpluginfuncdef)getprocaddress(lib, "create"); // pointer destructor inside of plugin typedef void(*destroypluginfuncdef)(fooclass*); destroypluginfuncdef destroyptr = (destroypluginfuncdef)getprocaddress(lib, "destroy"); // create new object = boost::shared_prt<fooclass>(plugincreatefactoryptr(), destroypluginfuncdef); a->callsomefunctionfromplugin(); and plugin should exported new process. on web i've found

How to prevent a client race condition between Meteor.userId() and subscription updates that depend on userId? -

i seeing repeatable issue user authenticates ("logs in") meteor server, , client subscription depends on userid updated (and dependent ui templates reactively update) before meteor.userid() registers successful login. for example, in code snippet, assert throw : var coll = new meteor.collection("test"); if (meteor.isserver) { meteor.publish('mineorpublic', function () { // publish public records , owned subscribing user return coll.find({owner: { $in: [ this.userid, null ]}}); }); } if (meteor.isclient) { var sub = meteor.subscribe('mineorpublic'); var cursor = coll.find({}); cursor.observe({ added: function (doc) { if (doc.owner) { // should true?! assert(doc.owner === meteor.userid()); } } }); } analogous added function above, if write template helper checks meteor.userid() , see value of null , when invoked data context o

shell - Copy all files in directory except ".txt" and not to replace existing files -

i have copy file source directory destination directory , skip file extension ".txt" , not replace file if present in destination directory example source directory /a/aone.js /a/atwo.js /b/bone.txt /b/btwo.js destination directory /a/atwo.js then should copy /a/aone.js /b/btwo.js and skip "/a/atwo.js" because present in destination folder , skip "/b/bone.txt" because extension ".txt" i tried command not work find /path/to/source/ \( ! -name "*.txt" \) -type f | cp -n /path/to/destination/ -r cp -n /path/to/source/*(!*.txt) /path/to/destination/ -r assuming can use rsync , ( vaz verbose, archive , compress - believe other options self explanatory) rsync -vaz --exclude "*.txt" /path/to/source/ /path/to/destination/

cascading - how to avoid filling up hadoop logs on nodes? -

when our cascading jobs encounter error in data, throw various exceptions… these end in logs, , if logs fill up, cluster stops working. have config file edited/configured avoid such scenarios? we using mapr 3.1.0, , looking way limit log use (syslogs/userlogs), without using centralized logging, without adjusting logging level, , less bothered whether keeps first n bytes, or last n bytes of logs , discords remain part. we don't care logs, , need first (or last) few megs figure out went wrong. don't wan't use centralized logging, because don't want keep logs/ don't care spend perf overhead of replicating them. also, correct me if i'm wrong: user_log.retain-size, has issues when jvm re-use used. any clue/answer appreciated !! thanks, srinivas this should in different stackexchange site it's more of devops question programming question. anyway, need devops setup logrotate , configure according needs. or edit log4j xml files on cluster

ruby on rails - Spreadsheet Gem, upload and read file -

i'm trying upload , read file using spreadsheet, absolute path, can read file, when try upload file, can't read it. can read file? def upload file_data = params[:uploaded_file] #book = spreadsheet.open('/users/mymac/downloads/issues.xls') book = spreadsheet.open(file_data) sheet1 = book.worksheet('sheet1') # can use index or worksheet name sheet1.each |row| #todo end end i think question should you. haven't stated gem using read spreadsheet, spreadsheet , roo should both serve purposes. parsing xls spreadsheet in rails using roo gem

node.js - mongodb how to change array position -

i have mongodb document has array. there way rearrange order of array element? example - have 10 elements in array , need element in position 7 moved position 2. is possible? thanks if done within node, 1 option use mongoose along splice : for example, remove element @ position 7 (remember, 0th based): var position7 = doc.subdocs.splice(6, 1); then insert earlier in array, @ position 2: doc.subdocs.splice(1, 0, position7[0]); more information on splice function can found here: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/splice

asp.net - Firefox not loading all objects -

i've report has 5 pages(graphs) called through firefox send mails respective users.the scripting done in .net(and i'm novice @ it). the process used work fine until few days,but since past few days process has been failing send mail firefox loading 2 pages(graphs) , exiting after that. it sends mail when manually drag scrollbar load 5 pages. what reason that's stopping loading 5 images(graphs). we've removed add-ons except shock wave flash plugin required report. thanks lot! if (ds.tables[0].rows.count > 0) { (int = 0; <= ds.tables[0].rows.count; i++) { if (i < ds.tables[0].rows.count) { process p = process.start(@"c:\program files (x86)\mozilla firefox\firefox.exe", "http://172.18.12.13/charts/dailyreport.aspx?ceid=" + ds.tables[0].rows[i]["loginid"].tostring() + "&cename=&qu

sql - Update table from another table postgresql -

i have 2 tables. table a contains 3 columns: month,code,point while table b contains 5 column: code,point1,point2,point3,point4 . i want update point in table b based on months of table (only 4 months allocated points 1-4). i assume tablea (code) foreign key tableb (code), , tablea (month,code) unique. take explanation month can 1,2,3 or 4. update tableb b set point1 = (select point tablea month = 1 , code = b.code), point2 = (select point tablea month = 2 , code = b.code), (...)

android - How do you achieve Material design components pre API 21? -

have (or when will) google released support package material design such android-support-v21.jar ? are styles/drawables/anims available somewhere within android-sdk folder can used simulate z-axis background , animation effects without such compatibility library? edit google have released version 22 of android support library contains many of api 21 components can used down api 7. http://developer.android.com/tools/support-library/index.html this includes floating action buttons, recyclerviews, snackbars, toolbars, cardviews (which 1 stop solution elevation among of views) coordinatorlayouts (for fancy collapsing actionbars). with library it's more possible fake having api 21 (although wrapping in cardviews can tedious ;)) good luck!

javascript - Get instant results from dropdownlist with jquery/php -

i want dropdown list automatically collect right results database without refreshing page. i wrote code jquery somehow calls front-end twice instead of calling results of select statement. here's javasacript code: $(document).ready(function() { function ajaxloaded(response) { $('#performanceresults').html(response); } function dorequest() { $.ajax({ url: "results.php", type: 'post', success: ajaxloaded }); } $('#performance').change(dorequest); }); this method contains form: public function selectperformanceindicator() { $this->getresults (); $str = '<form >'; $str .= 'select performance indicator<br>'; $str .= '<select id = "performance">'; $str .= '<option value = "">select performance indicator</option>'; $str .= '<

xsd - xmlSchema apache in java -

i'm using library in java xmlschema of apache . create new object xmlschemaelement , set attributes minoccurs , maxoccurs , nillable in way: xmlschemaelement elem = new xmlschemaelement(); elem.setname("element1"); elem.setnillable(false); elem.setminoccurs(1); elem.setmaxoccurs(1); i xsd: <xs:element name="element1"> ........ </xs:element> i not attributes minoccurs, maxoccurs , nillable. how can fix problem? i should item xsd this: <xs:element name="element1" minoccurs="1" maxoccurs="1" nillable="false"> ... </xs:element> thank much. minoccurs , maxoccurs can used when element declaration nested in group, such <xs:sequence> . if creating top-level <xs:element> elements, it's illegal have attributes. try adding element child group (sequence, choice, all, etc.)

json - Laravel 4: Fatal error: Class 'Patchwork\Utf8\Bootup' not found in autoload.php -

i added "cviebrock/image-validator": "1.0.*" require section of composer.json . after, ran composer update , getting fatal error. :::error::: fatal error: class 'patchwork\utf8\bootup' not found in f:\xampp\htdocs\project\ bootstrap\autoload.php on line 46 script php artisan clear-compiled handling post-update-cmd event returned wi th error [runtimeexception] error output: update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with- dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [ packagesn] :::end of error::: :::composer.json require section::: "require": { "intervention/image": "2.*", "cviebrock/image-validator": "1.0.*" }, i need in rectifying fatal error. thanks & regards, michael sangma this error seems me there no patchwork/

Crystal Report No Header for SubReport -

can please give me clear instruction on how supress header (from main report) on sub report? appreciate it! using crystal report 9. need know how supress header on subreport comming main report. need header stay on main report dont want there in subreport when shows up.

shell - Linux redirect input via proc fd0, dev/pts -

Image
in ubuntu 13.04 using vmware, have 2 terminals(pid 1000 - /dev/pts0, pid 2000 - /dev/pts2) if terminal 2(/dev/pts2) ... echo 'ls -al' > /proc/1000/fd/0 i can see 'ls -al' prompts in terminal 0(/dev/pts0) however, visual result, not real command input terminal 0. what want redirect actual command input terminal 2 terminal 0 via /proc/pid(terminal 0's)/fd/0 , execute command terminal 0. is possible??, if is, how can this? thank in advance. this not possible, because bash 2 things when keyboard event <enter> happens. printing newline. executing entered command, if command completed. the logic, when command completed not simple. depends on conditional statements, backslashes etc. redirecting '\n' character stdin execute first step. guess impossible design, because shell, controlled shell horrible every security engineer. on multi-user linux, able write , execute commands on shells, running different users (e.g. root)

Jenkins: how can I clean the workspace except the vagrant directory? -

i have following setup: i use workspace cleanup plugin in jenkins clean workspace before each build. during build-process trigger vagrant up setup vm phpunit tests: $ vagrant $ ./runtest.sh $ vagrant suspend now when re-build project, vm gets build new 1 instead of resuming previous one. guess because of cleanup plugin removing .vagrant -directory, therefore making vagrant think should build new machine instead of resuming previous one. now have configured plugin exclude following patterns , have 'apply pattern on directories' -checkbox checked: **/*.vagrant .vagrant .vagrant/ ./.vagrant ./.vagrant/ but still .vagrant -directory gets deleted workspace on each new build, spawning brand new vm each time... does know how can exclude .vagrant -directory workspace cleanup plugin? turned out having logical error. did first task checkout , hard-reset specific branch master. step deleted .vagrant -directory after cleanup-task did expected do.

c# - Unable to call aspx page web method using jquery ajax call? -

here ajax call $(document).ready(function () { $("#btnsubmit").click(function () { alert("i in ?"); $.ajax({ type: "post", url: "testnew2.aspx/displaydata", data: "{}", contenttype: "application/x-www-form-urlencoded", datatype: "text", //success: function (msg) { // // replace div's content page method's return. // $("#btnsubmit").text(msg.d); // alert(msg.d); //} success: function (result, status, xhr) { document.getelementbyid("lbloutput").innerhtml = xhr.responsetext }, error: function (xhr, status, error) { alert(xhr.error); } }); });

javascript - Can't insert into database an autofill fields? -

it's first time asking here, i've been trying similar in other questions asked, , couldn't find it. i have form zip code line(textbox) , state line(textbox), now, stateboxes auto-filled javascript entering valid zip code. form bit longer. show relevant code has been edited me, select menu before (and worked fine - data entered databse), , changed it, no select needed. there css file, it's irrelevant (designing isn't issue) so, here html code : <html> <head>some content here</head> <body> <form method="post" action="process.php"> <div class="title"><h2>my form title</h2></div><br> <div align="center" class="element-name"> </span> <span align="center" id="zipbox" class="namefirst"> <input type="text" class="medium" pattern="[0-9]*" name=&qu

Dart program refusing to execute because of MIME type checking? -

i've been trying install our client.dart web program our server, referenced index.html file, , has been working fine locally. there have been number of issues have found way around, 1 has me stumped. note: client application using polymer , has http code in it. uses websockets. the exact message i'm getting is: refused execute script ' http://swarmshepherd.com:9494/client.dart ' because mime type ('application/octet-stream') not executable, , strict mime type checking enabled. there "header" (http) of: , "x-content-type-options=nosniff" seems related problem. nothing has made sense me has worked yet. longer term must able run in chrome, message happening in dartium. the message found in developertools/js monitor - , first , message i'm getting. (i thought there might chomium/dartium option turn off strict checking nothing shows anywhere, , have tried can think of in header section of http code (which iffy , frust

mysql - Subtract colums from two tables -

there 2 tables need total available quantity table t1 +-------------+------------+ | code | qty | +-------------+------------+ | | 500 | +-------------+------------+ table t2 +-------------+------------+ | code | qty | +-------------+------------+ | | 10 | +-------------+------------+ | | 20 | +-------------+------------+ with code result 970 instead of 470: select `t1`.`code`, (ifnull(sum(`t1`.`qty`),0) - ifnull(sum(`t2`.`qty`),0)) totalqty `t1` left join `t2` on `t1`.`code` = `t2`.`code` group `t1`.`code` what i'm doing wrong? check code :) select code,ifnull(sum(qty),0)-ifnull((select sum(qty) t2 t1.code = code),0) answer t1 group code i edit answer incase want add condition base on code , prevent returning of null value try bro

c# - SQL Server -> .Net int conversion -

i had line of code in winforms app (target platform x86) made contained this... if (dtmax.rows[0][0] != system.dbnull.value) iprevmax = (int64)(dtmax.rows[0][0]); i know dtmax.rows[0][0] max of column in given table in sql server. datatype of column int . now - line of code @ point threw exception. don't know exception on holiday , nobody took note!! angry face. however line changed to.... if (dtmax.rows[0][0] != system.dbnull.value) iprevmax = convert.toint64(dtmax.rows[0][0]); ...and works. i understand few things... .net equivalent of sqlserver int int32 - should have been unboxing that. convert "safer" unboxing but don't understand why line of code work , @ point fail unbox? possible reasons - in spite of annoyingly not knowing actual exception...

android - How to represent 2 cursors as 1 sorted cursor? -

i have 2 different sets of data, each of them use own contentprovider . querying them can 2 different cursors. 2 cursors has 2 different primary keys, there's 1 , same field ( date ) can use ordering (other fields different). my goal have 1 final merged cursor sorted date field. have investigated mergecursor doesn't fit me, since returns merged/concatenated (but not sorted cursor ). any ideas, clues? you can try class aosp repository: https://android.googlesource.com/platform/frameworks/base.git/+/android-4.4.4_r1/core/java/com/android/internal/database/sortcursor.java there performance warning @ beginning of class if don't have 10k or 100k records might fine.

python - Best class naming conventions with multiple implementations -

i dealing project in have implement rather complex data structure p several ways (all of them in python). hoping of help, here how structured portion of project: + p/ |----+ a/ | |----p.py | |----+ b/ | |----p.py | |----factory.py |----abstractp.py in p.py have different implementations of p classes. named same, p (they conform interface since inherit class abstractp extends abcmeta ). i planning on using factory pattern instantiate object of class p specifying parameter. @ moment, in factory.py avoiding name clashes using python import tricks: from p.a.p import p p_a p.b.p import p p_b i'm doing thinking use p.py files indipendently in next project not naming classes p_a , p_b start. is bad practice? best naming convention implementations in context? you should name them after particular aspect of implementation. take example couple of typical implementations of list type container: abstract class list (defines basic interfaces/behaviour

objective c - Application Get hanged when refreshing automatically -

i working map view in location based application.i tried refresh mapview live location.but gets hanged few refresh.what reason? - (void)viewdidload { [super viewdidload]; atimer = [nstimer scheduledtimerwithtimeinterval:5 target:self selector:@selector(timerfired:) userinfo:nil repeats:yes]; } -(void)timerfired:(nstimer *) thetimer { [self viewdidload]; nslog(@"timerfired @ %@", [thetimer firedate]); }

android - cancel Service when user clicks Notification -

similar this post got service work in background. when service starts, i'm displaying notification. can assing intent notification triggered when user clicks onto notification. activity started. but how can use notification inform background service user want's cancel operation? you can have broadcastreceiver stop service, triggered through pendingintent of notification. have @ pendingintent.getbroadcast(...) , use instead of pendingintent.getactivity() method. can use this: intent broadcastintent = new intent(context, yourbroadcastreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(context, 0, broadcastintent, 0); notification noti = new notification.builder(this) ... .setcontent(pendingintent); .build(); notification.setcontent(pendingintent); the broadcastreceiver inner class in service call stopservice() in onreceive() method.

html - using jquery to replace text delete my span and his class -

i want replace text contained span class, code, thing happen span class deleted here's code: $("input.textinput").on("keyup", function () { target = $(this).attr("lang").replace("text", "div"); $("." + target).text($(this).val()); }); and here's example div:ì (before replace): <div class="targetdiv"><span class="test"> text replaced </span></div> and how looks after script (after replace): <div class="targetdiv">replacing text</div> edit ok, here's fiddle: http://jsfiddle.net/9xs9t/ you're directly targeting div, , calling .text() replaces entire content of div text. change line: $("." + target).text($(this).val()); to $("." + target + " span").text($(this).val()); live example: http://jsfiddle.net/mtg9b/

c# 4.0 - C#: has it sense convert string to secure string? -

i use secure string have password in variable. password database, because using hashed password , need compare password given user , tha hashed password have in database. well, retrieve password database, hashed pssword. string, if convert string secure string, how start string, unsecure, has sense convert secure string? because string exposed since database , store in string in first moment. how correct way compare stored password in database , password given user? i using repository work , repository executed in local computer of user, not in server. thanks. as wrote, not make sense convert existing password string, damage done. however, since talking hash, not password, in general fine query (please call me out if wrong). but additionally, can ask db equality of hashes instead of querying existing hash. have @ this question more information, accepted answer has lot of excellent links.

Jquery's Ajax and killing SQL process on PHP -

so have script import .csv file, line line using "insert query" database. i want user able stop script anytime. here's ajax call : postselect = $.post('addcsvtodatabase.php'); first try : here's initial handler stop script : $('#input').click(function(){ postselect.abort(); }) i noticed abort() method did stop script, data still being inserted database second try : from .php script run on initial ajax call (addcsvtodatabase.php), save process id of sql query : $idconnexion = $connexion->query('select connction_id()')->fetch(pdo::fetch_assoc); $idconnexion = $idconnexion["connection_id()"]; $_session['idconnexion'] = $idconnexion; then, make ajax call abortsql.php script grab process id , try kill : $requete = "kill ".$_session['idconnexion']; $connexion->query($requete); here's input handler looks : $('#input').click(function(){ post

jquery - Overflow is not working in Safari -

overflow not working in safari. please help. in circles, overflow appering in other browser hidden due overflow in safari not hidden. http://realestate.fssdemo.com/services/ check fiddle remove style position: relative and adjust margin

excel - To traverse rows into columns -

Image
i having 3 columns (app, ticket, efforts). task separate username accidentally gets added in column (app) , apply in new column (column d). data below. app ticket efforts james, lijo app1 23 13 app2 44 22 app3 55 33 tom, cruise app2 44 22 app1 33 42 output expected : app ticket efforts columnd app1 23 13 james, lijo app2 44 22 james, lijo app3 55 33 james, lijo app2 44 22 tom, cruise app1 33 42 tom, cruise stick formula in d3 , drag down last row =if(isnumber(b2),if(b3<>"",d2,""),a2)

javascript - set the model on the center of the scene in threejs -

am using following code visualize object on center of scene, working fine json loder, if use objloder or objmtlloder not working function modelloadedcallback(geometry, materials) { /* create object geometry , materials loaded. there can multiple materials, can applied object using meshfacematerials. note tha material can include references texture images might finish loading later. */ var object = new three.mesh(geometry, new three.meshfacematerial(materials)); /* determine ranges of x, y, , z in vertices of geometry. */ var xmin = infinity; var xmax = -infinity; var ymin = infinity; var ymax = -infinity; var zmin = infinity; var zmax = -infinity; (var = 0; < geometry.vertices.length; i++) { var v = geometry.vertices[i]; if (v.x < xmin) xmin = v.x; else if (v.x > xmax) xmax = v.x; if (v.y < ymin) ymin = v.y; else if (v.y >

Fail when install Ruby on Rails -

i use command install rails. sudo gem install rails -v then got error message. no ideas reason... [root@li608-165 ~]# sudo gem install rails -v head https://api.rubygems.org/api/v1/dependencies 200 ok https://api.rubygems.org/api/v1/dependencies?gems=rails 200 ok https://api.rubygems.org/api/v1/dependencies?gems=actionmailer,actionpack,actionview,activemodel,activerecord,a ctivesupport,bundler,railties,sprockets-rails 200 ok https://api.rubygems.org/api/v1/dependencies?gems=arel,builder,erubis,i18n,json,mail,minitest,rack,rack-test,ra ke,sprockets,thor,thread_safe,tzinfo 200 ok https://api.rubygems.org/api/v1/dependencies?gems=hike,mime-types,multi_json,tilt,treetop 200 ok https://api.rubygems.org/api/v1/dependencies?gems=polyglot,polyglot 200 ok /usr/lib64/ruby/gems/1.8/gems/json-1.8.1/.gitignore /usr/lib64/ruby/gems/1.8/gems/json-1.8.1/.travis.yml /usr/lib64/ruby/gems/1.

c# - Add TextBox in GridView at specific column? -

i have gridview: <fieldset class="loadedform"> <legend>od</legend> <asp:gridview id="grv_od" runat="server" autogeneratecolumns="false" datakeynames="lbpr_id" onpageindexchanging="grv_od_pageindexchanging" onrowdatabound="grv_od_rowdatabound"> <columns> <asp:templatefield> <itemtemplate> <asp:checkbox id="chk_items" runat="server" /> </itemtemplate> </asp:templatefield> <asp:boundfield datafield="lbpr_id" visible="false" /> <asp:boundfield datafield="lbpr_name" /> <asp:boundfield datafield="lbpr_parentid"

sharepoint - make data-app-id configurable in yammer javascript SDK -

<script type="text/javascript" data-app-id="*****************" src="https://assets.yammer.com/assets/platform_js_sdk.js"></script> i want make data-app-id configurable not static. developing sharepoint app part yammer. test , production networks different data-app-id both networks different.is there way can make configurable deploying on production don't need make change in code , can put in property. i got solution. can this.. yammerappid = "***************"; if (yammerappid != "") { document.write('<script type="text/javascript" src="https://assets.yammer.com/assets/platform_js_sdk.js" data-app-id="' + yammerappid + '"><\/script>'); } else { alert("please configure yammer appid webpart property."); } </script>

printing - .NET PrintDocument does not print monospace fonts correctly -

i code print few blocks of text: var doc=new printdocument(); doc.printpage += (sender, e) => { e.graphics.drawstring( "123456789 123456789 123456789 123456789 123456789 123456789 123456789 ", new font("courier new", 12), brushes.black, 0, 0); }; doc.print(); courier new supposed 10 charsperinch, each block (including space) should 2.54 cm long. when printing - regardless on printer, measure 13.1 cm 5 blocks instead of 12.7 cm. when draw rectangles 1 inch width, can see text longer should be, not general scaling problem, text printed wrong. can confirm , more importantly show me way around? need text 10 cpi, not 10.3 cpi experienced :-( "10 cpi" meaningful in previous century when dot-matrix printers still dominant. fell victim typographer's insistence on getting perfect letter shapes, very picky that. graphics class not keep secret, when use graphics.measurestring() on string you'll see 7.164388 inc

java - Data from Sql Database to an Array -

i put data sql database in array here code array: opendb(); cursor c = mydb.getspalte(); while (!c.isafterlast()) { s1nint[i] = c.getint(1); i++; c.movetonext(); } c.close(); closedb(); and here code getspalte(); method: public cursor getspalte() { string where= null; cursor c = db.query(true, database_table, key_kaloa, where, null, null, null, null, null); if (c != null) { c.movetofirst(); } return c; } and if run these exception: 06-27 13:34:01.021: e/cursorwindow(24334): failed read row 0, column 1 cursorwindow has 1 rows, 1 columns. now got these command exception: number[] series2numbers = {/*s1nint[i-6],s1nint[i-5],s1nint[i-4],s1nint[i-3],s1nint[i- 2],s1nint[i-1],*/s1nint[i]}; this exception this: graph.onstart() line: 75 graph(fragment).performstart() line: 1801 fragmentmanagerimpl.movetostate(fragment, int, int, int, boolean) line: 937 fragmentmanagerimpl.movet

dotnetnuke - DNN 7 returning internal server error 500 on invalid tabname parameter -

i'm trying set 404 error handling dnn instalation. enviroment: dnn 07.01.02 iis 8.5 i have created dnn page on root named "404". when try nonexisting url /asdf 404 page displayed correctly. however, if try /default.aspx?tabname=asdf 505 - internal server error page shown. shouldn't 2 behave same due url rewriting.

apigee - Working around the wildcard limitation in defining hierarchical APIs -

suppose want create following apis: /movies/{movieid}/cast /movies/{movieid}/crew /movies/{movieid}/awards on recent versions of apigee, wildcards no longer allowed in base url. achieve ones above, first created api proxy /movies . defined 3 separate resources under it, each starting wildcard: /*/cast /*/crew /*/awards here's couple of questions: is way define wildcards in hierarchical api structure? is there way define these 3 separate api proxies? say created api basepath /movies , consume /movies/jaws/cast. can crate preflow policy extract path variable this: <extractvariables async="false" continueonerror="false" enabled="true" name="extract-uri"> <displayname>extract uri</displayname> <faultrules/> <properties/> <uripath> <pattern>/{movieid}/{function}</pattern> </uripath> </extractvariables> you have 2 variables, 1 variab

How can we change message of inbuilt annotation provided by java at run time -

how can change message of in built annotation provided java @ run time? there links talk changing message of custom annotation : e.g can change annotation message @ run time? above link helped me solve 1 problem. but want know how annotations provide java itself. e.g @defaultvalue @digit @min i can use @min(value = 1, message = "value must 1 or more") but static message, there way make dynamic. -cheers

asp.net mvc 4 - Getting routes to handle static content types that produce 404s -

i have mvc site replacing old website. want able handle requests old static html files redirect 404 error handler on mvc site - i'd provide 301 code instead of 404 let crawlers know content has moved at moment when try , navigate static content iis 404 error. can use custom error handling handle missing file i'm not sure way working <httperrors errormode="custom"> <remove statuscode="404"/> <error statuscode="404" path="http://localhost/site/error/notfound" responsemode="redirect"/> </httperrors> is there better way or way else doing it? how provide 301 instead of 404 since it's static file handler that's serving content? is there way mvc handle requests file extensions , catch 404s these if don't exist?

javascript - Background-reacting navigation for one page websites - working script -

Image
good morning! i want share simple script made purposes of company new website. allows make floating navigation bar smoothly changes background. for it's working jquery. question - possible made in pure css? previous idea make navigation container overflow: hidden , position: absolute + menu position: fixed. worked until realized firefox can't handle combination. i'm waiting yours ideas :) here's code , preview: var nav = $('.nav'), navheight = nav.height(); // duplicate navigation var navreversed = nav .clone(true) .addclass('nav-reversed') .insertafter(nav); var navs = $('.nav'), slides = $('.slide'); /* ... */ // onscroll event $(window).on('scroll resize', function() { var scrolltop = $(document).scrolltop(), slide; // find first visible slide slides.each(function() { if ($(this).offset().top > scrolltop) return false; slide = $(this);

php - PayPal hitting notification URL repeatedly -

Image
i have made payment through paypal adaptive payment , succecced then send validation request , gotted status=verified here code : function process_new() { $req = 'cmd=_notify-validate&'.file_get_contents("php://input"); $ipnmsg=$this->decodepaypalipn($req); $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); curl_setopt($ch, curlopt_http_version, curl_http_version_1_1); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_postfields, $req); curl_setopt($ch, curlopt_ssl_verifypeer, 1); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_forbid_reuse, 1); curl_setopt($ch, curlopt_httpheader, array('connection: close')); $res=curl_exec($ch); curl_close($ch); //if ($this->instantpaymentnotification->is_valid($req)) if($res=='verified') // got verified here { $txnids=array(); $notifications = $this->instantpayment

objective c - iOS Layout Change on Hiding a view -

if have 3 uilabel s on view next each other, best approach hiding middle one, , third 1 shift , take it's space? so example: first line second line third line if hide second line, doesn't show. still takes space. end this: first line third line what considered 'best' approach making third line slip second lines space? i've been looking @ uicollectionview , seems bit extreme. i write bunch of code builds view up, putting things in order should be, involve significant chunk of work, , i'm there's simpler way... maybe i'm wrong! any great! thanks. (in android native/java free. :-) it not of code if removing one. [secondlinelabel sethidden:yes]; [thirdlinelabel setframe:[secondlinelable frame]]; the problem comes when want second lable re-appear. need store frame somewhere. if more lables in row more general useful. might want think using table. can embed tables view layout along other view items. , can quite introduce o