Posts

Showing posts from August, 2014

javascript - How to use HTML5 history push state instead of window.location.hash? -

now using window.location.hash history management below, how can replace html5 history push state. var statehistory = []; function changehistory(page) { var l = statehistory.length, state = window.location.hash; if (l === 0) { statehistory.push(state); return; } if (state === statehistory[l - 2]) { statehistory.pop(); } else { statehistory.push(state); } }; you can use html5 history pustate function more info...... function changehistory(page) { window.history.pushstate({page:""+page},""+page); };

Wrongly implemented Fibonacci Sequence in Scala -

was @ scala meetup , discussing "scala way" of doing things... someone asked different developer how / implement fibonacci sequence in scala... person answered following code (only told while worked, non-optimal): def fibonacci(n: int):bigint = n match { case 0 => 0 case 1 => 1 case _ => fibonacci(n - 1) + fibonacci(n - 2) } what's wrong method? what ways improve code, scala way? the problem function, described non-tail recursive calls. means recursivity involved here needs stack work (in sample, it's call stack ). in other words, function equivalent of: import scala.collection.mutable.stack def fibonacci(n: int): bigint = { var result = bigint(0) val stack = stack.empty[int] stack.push(n) while (stack.nonempty) { val x = stack.pop() if (x == 1) { result += 1 } else if (x > 1) { stack.push(x - 2) stack.push(x - 1) } } result } as can see, that's not efficient, it

ruby - Fill the array elements with nil -

i have array this: [[1,2],[2],[3,4,5,6],[7]] i want fill array elements nil . how result: [[1,2,nil,nil],[2,nil,nil,nil],[3,4,5,6],[7,nil,nil,nil]] i tried: arr=[[1,2],[2],[3,4,5,6],[7]] l=arr.max_by{|x|x.size}.size arr.map{|x|x+[nil]* (l-x.size)} is there easier way it? an orthodox way be: a = [[1,2], [2], [3, 4, 5, 6], [7]] max = a.map(&:length).max - 1 a.each{|a| a[max] ||= nil} # => [[1, 2, nil, nil], [2, nil, nil, nil], [3, 4, 5, 6], [7, nil, nil, nil]] a more interesting way be: a = [[1,2], [2], [3, 4, 5, 6], [7]] a.max_by(&:length).zip(*a).transpose.drop(1) # => [[1, 2, nil, nil], [2, nil, nil, nil], [3, 4, 5, 6], [7, nil, nil, nil]]

java - How to fetch SQLite data from selected Spinner item in Android -

i have retrieved first column data in spinner . want retrieve sqlite data when select spinner item. data displayed in edittext s. when run app, data cannot displayed in edittext . can give me suggestion?thanks in advance. here code spinner_searchbyempname = (spinner)findviewbyid(r.id.searchbyempname); loadserachbyproject() ; spinner_searchbyempname = (spinner)findviewbyid(r.id.searchbyempname); loadserachbyproject() ; spinner_searchbyempname.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub selectedemployeename = spinner_searchbyempname.getselecteditem().tostring().trim(); system.out.println("selectedprojectname " + selectedemployeename); } @override public void onnothingsele

mysql - How can I write a SELECT query with starting row of particular PK? -

i'm using mysql, support offset , limit, it's great. if want query first row equal particular primary key instead of page index? e.g. have table: id name height 1 kevin 1.67 2 bob 1.82 3 jane 1.70 4 wayne 1.59 i want list of people order height asc first page's last id 1, whole view 4 1 3 2 (page size = 2) something should like: select id,name,height table offset ???? limit 2 order height asc so should get: 3 jane 1.70 2 bob 1.82 try this logic : page_size page_number offset 2 1 (2*1)-1 = 1 2 2 (2*2)-1 = 3 2 3 (2*3)-1 = 5 query : select id,name,height table order height asc, id asc limit 2 offset (page_size * page_number)-1

Android: App shows xml file data in emulator but not in device -

i have app performs task xml file , file in /data/data/my.package/files/test.xml. data extracted xml file in emulator in real device there no data all. i thought there might me permission problem , have set permission these <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="android.permission.access_network_state" /> but there no data display in real device. app running in emulator. any appreciable.

mysql - php5-msql installed on Ubuntu but not shown in phpinfo.php -

i setting nginx+php+mysql on ubuntu 12.04. i used apt-get install php5-mysql to install mysql module php. however, seems installed , enabled, yet shown in phpinfo.php , cant php application connect mysql server. php app accessible, , can view things on phpinfo.php. btw, mysql running normally, because running rails app using it, know working fine. as @vstm said quick summary others answer quicker: 1. kill php-cgi killall php-cgi 2. restart php-fpm /etc/init.d/php5-fpm restart or service php5-fpm restart 3. double check with grep -e 'extension=(pdo_)?mysql.so' -r /etc/php5

dynamic - Overwrite the LoginWidget and Set DestinationPageUrl dynamically in Sitefinity -

i want add custom code during login function, in particular want redirect user after login previous page. for example: i'm on page , want download page, i'm not authorized. pops popup link login page. after successful login i'm on page a. for purpose want overwrite loginwidged , set value to"this.destinationpageurl" dynamically. i read similar issues here , here , there isn't example how overwrite loginwidget class. i create customlogincontrol.cs file in project , register new custom control, after rendering on page, didn't work. login button not make nothing. i'm not sure have , of methods have overwrite. namespace sitefinitywebapp.usercontrols { public class customlogincontrol : telerik.sitefinity.web.ui.publiccontrols.loginwidget { protected override void render(system.web.ui.htmltextwriter writer) { this.destinationpageurl = "http://previouspage.com"; base.render(writer);

html - Old Skool CSS Websafe Font Callout -

i'm working on customers website , insist use same font had before. previous (drupal) site had cascading style sheet callout: body { font: 76%/170% arial,sans-serif; } as understand it, correlates websafe font, browser looks users operating system , tries match font, in case arial first , if not, sans-serif. nothing downloaded web. based on testing, native font size seems 16px, , native line height seems 20px. fractional percentage numbers indicate font-size (as ratio 16px) , line-height (as ratio calculated font-size). in case font-size observed (via whatfont) = 12.1667px , line-height of 20.6833px the combination shown above seems have been common drupal selection, @ least appear google searches on topic. this whole thing seems way odd. think... body{ font-family: arial, sans-serif; font-size:12px line-height:21px} makes more sense, communicates intent follow, etc. why % / % system identifying font-size? native height 16px? feels obfuscation nothing

c# - Is it possible to pretend to be lower .NET version than it actually is? -

sharepoint 2010 has version check in single place (also starting update wss 3.0 has such check also): ... version version = environment.version; if (version.major > 2) { ... throw new platformnotsupportedexception(@string); i know, should not this, out of curiosity - possible overcome without writing huge proxy? just out of curiosity, wondering if possible of these: adjust check in sharepoint's dll @ runtime pass (class, using sealed , internal, if you're curious, microsoft.sharepoint.administration.spconfigurationdatabase class in microsoft.sharepoint.dll) temporary override environment.version return value, like: using (new environmentversionoverride("2.0")) { ... } some other way? update: environment.version decompiled source: public static version version { { return new version("4.0.30319.18444"); } } first , foremost, wss 3.0/share point 2010 created such engineers @ microsoft knew version of comm

javascript - Add existing image files in Dropzone -

i using dropzonejs add image upload functionality in form, have various other fields in form have set autoprocessqueue false , processing on click on submit button of form shown below. dropzone.options.portfolioform = { url: "/user/portfolio/save", previewscontainer: ".dropzone-previews", uploadmultiple: true, paralleluploads: 8, autoprocessqueue: false, autodiscover: false, addremovelinks: true, maxfiles: 8, init: function() { var mydropzone = this; this.element.queryselector("button[type=submit]").addeventlistener("click", function(e) { e.preventdefault(); e.stoppropagation(); mydropzone.processqueue(); }); } } this works fine , allows me process images sent when form submitted. however, want able see images uploaded user when edits form again. went through following post dropzone wiki. https://github.com/enyo/dropzone/wi

excel - Prevent user from formatting cells and changing data validation, without protecting sheet -

other users working in excel sheet created. due complex reasons, protecting not possible. hence possibility highlight cells colours , other garbage. is there way prevent cells being formatted (e.g. vba) in unprotected environment? also, cells have data validation "maximum number of digits". can overruled copy/paste. here also, there solution, e.g. in vba?

php - Phalcon: not found page error handler -

how create 404 error page manual bootstrap example in app ? http://album-o-rama.phalconphp.com/ i use dispatcher : $di->set( 'dispatcher', function() use ($di) { $evmanager = $di->getshared('eventsmanager'); $evmanager->attach( "dispatch:beforeexception", function($event, $dispatcher, $exception) { switch ($exception->getcode()) { case phdispatcher::exception_handler_not_found: case phdispatcher::exception_action_not_found: $dispatcher->forward( array( 'controller' => 'error', 'action' => 'show404', ) ); return false; } } ); $dispatcher = new phdispatcher(); $dispatcher->seteventsmanager($evmanager); return $dispatcher;

osx - ./xsum: Permission denied make: *** [xsum.out] Error 126 -

i trying insall f2c/f77 compiler on mac osx using instructions given http://www.webmo.net/support/fortran_osx.html , following error : ./xsum: permission denied make: *** [xsum.out] error 126 please , in installation misses create : /usr/local/bin/f2c i followed folowing : chmod +x install_f2c_osx.csh sudo ./install_f2c_osx.csh ps : install_f2c_osx.csh contains following code : `#! /bin/csh setenv install /usr/local curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar" tar -xvf f2c.tar gunzip -rf f2c/* cd f2c mkdir libf2c mv libf2c.zip libf2c cd libf2c unzip libf2c.zip cp makefile.u makefile make cp f2c.h $install/include cp libf2c.a $install/lib cd ../src cp makefile.u makefile make cp f2c $install/bin cd .. mkdir -p $install/share/man/man1 cp f2c.1t $install/share/man/man1 cp fc $install/bin/f77 chmod +x $install/bin/f77 cd .. rm -rf f2c echo "==================summary=================="

How can I get ruby's JSON to follow object references like Pry/PP? -

i've stared @ long i'm going in circles... i'm using rbvmomi gem, , in pry, when display object, recurses down thru structure showing me nested objects - to_json seems "dig down" objects, dump reference others> here's example: [24] pry(main)> g => [guestnicinfo( connected: true, deviceconfigid: 4000, dynamicproperty: [], ipaddress: ["10.102.155.146"], ipconfig: netipconfiginfo( dynamicproperty: [], ipaddress: [netipconfiginfoipaddress( dynamicproperty: [], ipaddress: "10.102.155.146", prefixlength: 20, state: "preferred" )] ), macaddress: "00:50:56:a0:56:9d", network: "f5_real_vm_ips" )] [25] pry(main)> g.to_json => "[\"#<rbvmomi::vim::guestnicinfo:0x000000085ecc68>\"]" pry apparently uses souped-up pp, , while "pp g" gives me close want, i'm kinda steering hard can toward js

Python - Is there a way to trace back the current position of a file object by one line -

i have test file (not python script) contains multiple sequences of form: testfile (not python script) #gibberish #gibberish newseq name-and-details 10 20 30 newseq name-and-details 10 20 30 #gibberish #gibberish newseq name-and-details ...and forth then, have python script reads file input. each new sequence, new python-list created store contents. inputfile = open('testfile','r') moreseq = true newline = inputfile.readline() while moreseq: while (not ('newseq' in newline)): newline = inputfile.readline() newlist = [] moreseq = newlist.listentry(inputfile) listdb.append(newlist) but when file object inputfile passed listentry method, wish position point beginning of newseq , not subsequent index: i.e. wish point newseq #1 line, rather 10 something . how can trace position of file object 1 line, or fixed measure in lines. believe seek doesn't work in case. this common problem solved unreading line in following code

AngularJS Protractor E2E - mock httpBackend with absolute URLs -

i have started using protractor e2e ui testing angularjs app. the base url app looks - http://localhost:8181/web-module/?username=admin this url redirects security-module in actual application given username. security-module running on different port - 9191. the redirected request looks - http://localhost:9191/security-module/user/?username=admin when try mock request using $httpbackend using - describe('home page', function () { var ptor = protractor.getinstance(); var httpbackendmock = function () { var app = angular.module('httpbackendmock', ['ngmocke2e']); app.run(function ($httpbackend) { var current_user = {"username":"admin","password":null,"fullname":"system admin","email":"admin@example.com"}; $httpbackend.whenget('http://localhost:9191/security-module/user/?username=admin').respond(function(method, url, da

c# - Visual Studio becomes laggy and freezes with too much parallel loops -

we found strange issue in visual studio. if put more 6 or maybe more parallel loops each other, visual studio becomes laggy. if click loop, , try scroll, or try click outside of loops, click loop again, vs freezes 5-10 secs. simple loops problem never occurs, think problem that, in case of parallel loops have actions, , maybe kills ide. we have tested both vs2012 , vs2013 , it's same. here example: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication1 { class program { static list<string> _list = new list<string>(); static void main(string[] args) { parallel.foreach(_list, element1 => { parallel.foreach(_list, element2 => { parallel.foreach(_list, element3 => {

c++ - What is a glibc free/malloc/realloc invalid next size/invalid pointer error and how to fix it? -

you seeing question because question has been closed duplicate of this. moderately complete list of related questions, please see a long list of possible duplicates — c memory allocation , overrunning bounds on meta stack overflow. example question from free char*: invalid next size (fast) asked noobie on 2014-04-11. i freeing char* after concatenation process, receive error: free(): invalid next size (fast): 0x0000000001b86170 this code: void concat(stringlist *list) { char *res = (char*)malloc(sizeof(char*)); strcpy(res, list->head->string); list->tmp = list->head->next; while (list->tmp != null) { strcat(res, ","); strcat(res, list->tmp->string); list->tmp = list->tmp->next; } printf("%s\n", res); free(res); } generic question when running program, see error message this: *** glibc detected *** ./a.out: free(): corrupted unsorted chunks: 0x123456

java - Spring MVC POST method -

here controller class snippet @requestmapping(value = "/createagent", method = requestmethod.post) @responsebody public string createagent(@requestbody string json) { system.out.println(json); } how go passing json object method. can pass through url in way? if pass way(although seems wrong), http://localhost:8080/surveyapp3/createagent/{"a_id": 8746574632, "pwd": "abcd", "pim_id": 3, "m_id":9738247882} i error saying warning: no mapping found http request uri [/surveyapp3/createagent/%7b%22a_id%22:%208746574632,%20%22pwd%22:%20%22abcd%22,%20%22pim_id%22:%203,%20%22m_id%22:9738247882%7d] in dispatcherservlet name 'spring' i tried using ajax request welcome file index.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3

C Math pow(): unexpected results -

this question has answer here: pow() seems out 1 here 4 answers consider following code: #include <math.h> #include <stdio.h> int main() { printf("%f\n", pow(43,10)); } this outputs: 21611482313284248.000000 see http://codepad.org/esa4asf2 playground. but if run operation windows calculator (x^y function) result: 21611482313284249 what's happening?? in ieee-754, double (binary-64) can represent integers 9007199254740992 (that 2 power 53). after not integer numbers can represented in double . number 21611482313284249 greater 9007199254740992 , cannot represented in double .

regex - How does mod_rewrite send parameters? -

i make file "page.php" name , wrote code in it: echo $_get['product']; and in ".htaccess" wrote code: rewriteengine on rewriterule (.*)$ page.php?product=$1 [l] all of these files in "apache" folder in localhost. problem url http://localhost/apache/book instead of "book" echos "page.php" have no idea why. it happening because rule looping twice, first time /apache/book uri second time /page.php to avoid situation need conditions this: # skip rule valid files rewritecond %{request_filename} !-f # skip rule valid directories rewritecond %{request_filename} !-d so combining /apache/.htaccess this: rewriteengine on rewritebase /apache/ # skip rule valid files rewritecond %{request_filename} !-f # skip rule valid directories rewritecond %{request_filename} !-d rewriterule ^(.+)$ page.php?product=$1 [l,qsa]

java - Which Jdk version will support windows xp -

which jdk version support windows xp? installed android studio on windows xp service pack 2 32bit, , asks jdk. downloaded jdk 8u5 windows i586 version. while opening exe file getting error message . error : procedure entry point regdeletekeyexa not located in dynamic link library advapi32.dll jdk 7 supported on windows xp. installer of jdk8 not allow jdk8 installed on winxp. far know there's no technical problem run jdk8 on winxp if you install it .

javascript - Accessing the Spotify API data (i.e. tokens) from redirect_uri via nodejs then redirect to angular app -

hi i'm creating web application using node.js , angularjs. i'm new both technologies. this app setup: node.js + mongodb rest api - handle server side requests communicate spotify ( http://localhost:3000 ) angularjs - app ( http://localhost:8080 ) spotify has made it's spotify web api public . i'm trying retrieve access token (and refresh token) can make api calls them. able access_token & refresh_token, however, since i'm coming http://localhost:8080/test http://localhost:3000/spotifyapi/login initialize auth http://localhost:3000/spotifyapi/callback receive tokens. if please help/guide me on how retrieve tokens/make api calls pass angularjs app, appreciated. below codes: i'm using grunt compile js 1 file in angular app node.js api ( http://localhost:3000/spotifyapi ) spotify.js var spotifywebapi = require('spotify-web-api-node'); var request = require('request'); var querystring = require('querystring')

actionscript 3 - Adobe AIR mp3 cut short -

i'm trying play mp3 file of 4 seconds. have problem playing of sound cut short. i have mac , when checking info of 2 files, 1 works great , problematic 1 notice 1 works great has 2 audio channel (as written in finder info window) , problematic has 1. is possible adobe air not handle 1 channel mp3 files well? the problem mp3 file mono, had 1 channel of audio in it. i've use audacity app duplicate audio channel , save mp3 stereo. this solve problem , full length of audio file playing.

ios - How to Sorting Mutable Array of NSNumbers using for Loop in Objective C? -

i tried this, not successful. can 1 sort problem? nsnumber *num1= [nsnumber numberwithint:5]; nsnumber *num2= [nsnumber numberwithint:3]; nsnumber *num3= [nsnumber numberwithint:7]; nsnumber *num4= [nsnumber numberwithint:9]; nsnumber *num5= [nsnumber numberwithint:2]; nsmutablearray *array =[nsmutablearray arraywithobjects:num1,num2,num3,num4,num5, nil]; int numlength = [array count]; int tempvalue; (int = 0; < numlength; i++) { for(int j = 0; j < numlength; j++) { nsnumber *temp=[array objectatindex:i]; int first =[temp integervalue]; nsnumber *temp1=[array objectatindex:j+1]; int second =[temp1 integervalue]; if(first > second) { tempvalue = second; [array replaceobjectatindex:j+1 withobject:temp]; [array replaceobjectatindex:i withobject:temp1]; } } } nslog(

php - Is it possible to get variables with get_defined_vars() but for the actual running script? -

i'm trying create function user-defined variables for, selectively, unsetting them before script finishes. in order used variables, must use get_defined_vars() function php provides with, has caveat (for me, @ least...): works in scope it's called. i to, ideally, encapsulate in function inside framework core namespace, \helpers\core function \helpers\core\getvariables() . actually, code looks this: foreach (array_diff(array_keys(get_defined_vars()), ["_cookie", "_env", "_files", "_get", "_post", "_request", "_server", "_session", "argc", "argv", "globals", "http_raw_post_data", "http_response_header", "ignore", "php_errormsg"], ["page"]) $variable) { unset($$variable); } basically, tries automate variable selection by: getting variable names array_keys(get_defined_vars()) defining set of reserved or

multithreading - Parallel processing - Connected Data -

problem summary: parallely apply function f each element of array f not thread safe. i have set of elements e process, lets queue of them. want process these elements in parallel using same function f( e ). now, ideally call map based parallel pattern, problem has following constraints. each element contains pair of 2 objects.( e = (a,b) ) two elements may share object. ( e1 = ( a1 ,b1); e2 = ( a1 , b2) ) the function f cannot process 2 elements share object. e1 , e2 cannot processing in parallel. what right way of doing this? my thoughts so, trivial thought: keep set of active , bs, , start processing element when no other thread using or b. so, when give element thread add , bs active set. pick first element, if elements not in active set spawn new thread , otherwise push of queue of elements. do till queue empty. will cause deadlock ? ideally when processing on elements become available right? 2.-the other thought make graph of these connected objec

Modify .htaccess for codeigniter URLS -

i trying remove index.php url in codeigniter. rewrite mod scripts on place can't find .htaccess file!! tried looking in root directory , everywhere else, no luck. from read should in application folder , when go there find .htaccess file , has deny all. not same content every 1 else sharing online before modification. please advise. actually don't find it; create along side index.php file contents: rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [l] in above example, http request other index.php, images, , robots.txt treated request index.php file. reference .

java - Diffrence between Runnable interface and Thread class realting Callstack -

i know basic difference between runnable interface , thread class in java. but, there difference related callstack between two? difference if extend thread class, wont able extend else, can pretty call start() method class since inherited. (dont forget override run() method). mythreadclass t = new mythreadclass(); t.start(); another difference if implement runnable, can extend class if want, need pass object parameter able run since implement run() method. thread t = new thread(new myrunnableclass()); t.start(); besides that, there isnt difference on how executed. edit: dont understand mean "callstrack".

javascript - Jquery Script only loading after page refresh -

i have script slide-up hover effect, loads though when refresh page reason. annoying... i think me calling in html script: jquery(function ($) { $('.bb-slide-cap').mosaic({ animation: 'slide', //fade or slide speed: 600, preload: 1 }); }); fiddle: http://jsfiddle.net/jjdn7/3/ i doesnt matter in case of 2 scripts sharing $ thought wrap in head. if working real challenge give try in real challenge. the link other readers if solves issue. jquery(function ($) { $('.bb-slide-cap').mosaic({ animation: 'slide', //fade or slide speed: 600, preload: 1 }); }); demo

sql server - TSQL Two cursors in row by row comparision -

i have got 2 views data. compare string column in first view every string in column in other view/table. need insert result comparison other table. at moment using 2 cursors forward only, going row row through both views/tables , inserting result. slow me. there other possibility double loop ( don't have index in second view) 2 cursors? i think can use cross join insert resulttable select a.column1 - b.column2 comparison table1 cross join table2 b; cursors extremely slow

php 5.5 - Semi-complicated dereferencing in PHP 5.5 -

the general idea so: i have class test the class has public static property $commands test::$commands array of key => callback pairs i have key saved in $cmdkey all considered, should able write this: self::$commands[$cmdkey]($argument); however, doing yields: php notice: undefined variable: $commands php fatal error: function name must string i solved issue doing this: $callback = self::$commands[$cmdkey]; $callback($argument); it's kind of blowback before dereferencing thing in php, though... am going crazy, or have found bug in php parser? it looks like test::$commands[$cmdkey](foo) is interpreted as test::($commands[$cmdkey])(foo) i.e. first fetch $commands[$cmdkey] contains , use function name in test . note test::$commands[$cmdkey] binds normally. consider: class test { public static $commands = array('x' => 'strlen'); public static function other() { print 'here!'; }

Table with variable number of columns in CSS -

Image
as example, how on desktop and on mobile i know can js modifying structure of table, haven't been able find css solution minimal js. try this: link css: table { width: 100%; border-collapse: collapse; } /* zebra striping */ tr:nth-of-type(odd) { background: #eee; } th { background: #333; color: white; font-weight: bold; } td, th { padding: 6px; border: 1px solid #ccc; text-align: left; } @media screen , (max-width: 760px), (min-device-width: 768px) , (max-device-width: 1024px) { /* force table not tables anymore */ table, thead, tbody, th, td, tr { display: block; } /* hide table headers (but not display: none;, accessibility) */ thead tr { position: absolute; top: -9999px; left: -9999px; } tr { border: 1px solid #ccc; } td { /* behave "row" */ border: none; border-bottom: 1px solid #eee; position: rel

css - Reduce space between alignment of HTML tables -

how can reduce space between parallel tables below code? , feel looks bit odd data grid tables placed @ extreme ends of page alignment. can suggest how can manage alignment tables reduce space of tables placed @ each of extreme ends left hand , right hand side? note: copy code in notepad , save test.html extension , open in ie or firefox check alignment problem have discussed above. here code: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>server status</title> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script

mathematical optimization - Linear programming constraint "x >= c or x = 0" -

i express linear program having variable can greater or equal constant c or equal 0. range ]0; c[ being unallowed. do know way express constraint in linear program, in way can solved using unmodified simplex implementation ? for example constraint : x1 >= 4 or x1 = 0. typical relation between constraints in linear program and. here or between 2 constraints. note: need solve problems having multiple variables in computationally efficient way. a mathematical program constraints you've defined cannot represented linear program , therefore cannot solved using unmodified simplex implementation. reasoning simple enough -- feasible set linear program must convex. set {x = 0 or x >= 2} not convex because contains points x=0 , x=2 not x=1 . as result, you'll forced use other mathematical programming techniques; 1 comes mind mixed integer linear programming (milp). each variable x_i constraint of form x_i = 0 or x_i >= c_i define auxiliary variable y_

ios - Verification of mobile number phonegap app -

i m developing phonegap app , want verify user's mobile number when registering app.this verification 1 time process . i want typical verification code method user has code texted them. user presented text field enter mobile number. receive verification code sms . verification code entered in app , verified. once verification successful, registration process complete. i researched how in phonegap ios have not reached useful tutorial . hope can point me in right direction on how accomplish this. use free missed call based mobile number verification service cognalys app. offering 500 free international verifications everyday , provides example platforms too. they released open source project phone-gap too. check website or github details.

c# - How do I get access to master page properties via user control markup? -

i have been searching internet , find resolves issue of accessing master page properties user control's code behind. unable find solution user control can have access master page's properties within markup. background: the master page dynamically adds user control onto page. master page has 2 properties user control needs access via markup. here code represent problem: master page's code behind properties: public imodule module { { return mycontext.current.module; } } public idictionary<string, object> arguments { { return mycontext.current.arguments; } } master page dynamically adds control in code behind (it has dynamically added in master page's code behind): protected override void oninit(eventargs e) { base.oninit(e); if (!(page vehicleform) && !(page vsrmanageform) && !(page vpbmanageform))

php - Define a discounted sale price Prestashop -

i have big problem, need products not specify discount applied product or difference in amount, directly specify selling price including tax, i'll explain: sales price without discount -> 30.00 sales price wanted -> 12:56 12:56 want write directly without having subtractions , / or calculations of percentages, can tell me how can do? thank much.

spring boot - Creating a custom Jasypt PropertySource in Springboot -

i'm using spring boot create simple web application accesses database. i'm taking advantage of autoconfiguration functionality datasource setting spring.datasource.* properties in application.properties . works brilliantly , quick - great work guys @ spring! my companys policy there should no clear text passwords. therefore need have sping.datasource.password encrypted. after bit of digging around decided create org.springframework.boot.env.propertysourceloader implementation creates jasypt org.jasypt.spring31.properties.encryptablepropertiespropertysource follows: public class encryptedpropertysourceloader implements propertysourceloader { private final standardpbestringencryptor encryptor = new standardpbestringencryptor(); public encryptedpropertysourceloader() { //todo: taken environment variable this.encryptor.setpassword("password"); } @override public string[] getfileextensions() { return new st

utf 8 - How do I convert strings to utf-8 that are in a latin-1 field but where originally another charset in a MySQL SELECT query? -

i've got table lots of texts in different languages. table , fields iso-8859-1 . data in fields encoded in different charsets before inserted. not converted latin1 , shows gibberish. can 1 of these: iso-8859-1 iso-8859-7 windows-1250 windows-1251 windows-1254 windows-1257 i know column maps kind of encoding. what convert them utf-8 when select them, in way not show gibberish in final output. my idea use convert() , the docs talking converting string encoding. string's encoding seems taken field's encoding. that's broken me. here's example of data looks if @ directly in db. Ðàä³àëüíà øèíà ïðèçíà÷åíà äëÿ áåçäîð³ææÿ.Ñïåö³àëüíî äëÿ land rover this supposed ukranian , encoded in cp1251 before being put latin1 field. if select foo bar without conversion , display webbrowser, telling use cp1251 show correctly cyrillic text in browser. what think need ignore fact field latin1 , convert cp1251 utf8 (or utf8mb4 ). however, not doing want:

python - Import __future__ division does only work if not imported from another file -

this works: (result = 0.01) from __future__ import division def division_test(): print 10/1000 division_test() this not: (result = 0) file a: from __future__ import division file b: from import * def division_test(): print 10/1000 division_test() why? if put things import numpy np into file a, can import file b same way , working time. __future__ imports not quite same others. per the documentation (emphasis mine): [ __future__ ] allows use of new features on per-module basis before release in feature becomes standard.

mapreduce - Control intermediates results in hadoop -

i want take control of intermediate results between map , reduce hadoop. want specify copy these results after map. choose data reduced. in summary want map's results before process shuffle , sort , want. if have solution please tell me. thanks you process data after particular mapper inputsplit. specify logic map function. i want specify copy these results after map use context java class , filesystem flush results on fs (local, hdfs, ftp, ...) i choose data reduced i want map's results before process shuffle , sort , want specify logic on map function in mapper class

How to remove cantFindType warning with aspectj agent? -

with aspectj agent, receive [xlint:cantfindtype] [loader@203d1d93] error can't determine whether missing type org.slf4j.logger instance of java.net.inetaddress when weaving type org.eclipse.jetty.util.log.slf4jlog when weaving classes when weaving how can remove warning ? thanks use meta-inf/aop.xml file with <aspectj> <!--<weaver options="-verbose ">--> <weaver options="-warn:none -xlint:ignore"> </weaver> </aspectj>