Posts

Showing posts from February, 2013

asp.net - How to access Page Controls value from C# webmethod -

i'm using c# asp.net web form application. using asp grid view control pages. once add ajax method c# web method capture data in web page. in c# web method can't capture grid view records. it's shows null always. how can records in web method. this code: [webmethod] public bool validategrid(string rowindex, string cellindex) { homedefault pagemethods = new homedefault(); pagemethods.validategridviewcontrols(convert.toint32(rowindex), convert.toint32(cellindex)); return true; } private void validategridviewcontrols(int rowindex, int cellindex) { foreach (gridviewrow row in grvprogram.rows) { } } in case grvprogram.rows alaways null. please me sort out issue, there 2 issues going experience current implementation: 1) zaki pointed out in comments, [webmethod] should public static bool validategrid(string rowindex, string cellindex) 2) suspicion homedefault pagemethods = new homedefault(); aspx page code-behind class. when

sql server - how can achieve the same result through sql query -

i have table tblempbatch username filename batchid f1 1 b f2 1 c f3 2 d f4 2 i want output like username filename batchid a,b f1,f2 1 c,d f3,f4 2 how can write sql query this. try this: (to use in table change table name needed , check column name) create table #table2(username varchar(10), filename varchar(10), batchid int) insert #table2 values('a' , 'f1' , 1) insert #table2 values('b' , 'f2' , 1) insert #table2 values('c' , 'f3' , 2) insert #table2 values('d' , 'f4' , 2) select username = stuff(( select ', ' + t2.username #table2 t2 t2.batchid = t1.batchid group t2.username xml path(''), type).value('.', 'varchar(max)' ), 1, 2, ''), filename =

AngularJS bootstrap.ui modal not showing right -

i trying display modal dialog using angularjs bootstrap.ui.when $modal.open(...) appears on screen line.before have problem screen grays out ( angularjs bootstrap.ui modal not showing solved problem, added new bootstrap css cannot figure out why don't see modal screen. using visual studio 2013, mvc 5, angularjs 1..2. trying follow tutorial: http://angular-ui.github.io/bootstrap/ ; getting no error reported javascript console. app defined follows: var app = angular.module("app", ["nggrid", "ui.bootstrap"]); app.controller("ctrlcontroller", function ($scope, $http, $log, $modal) { $scope.on = function () { .... var modalinstance= $modal.open( { templateurl: 'http://localhost:58652/home/testview', controller: "ctrlcontroller", } ); } and markup is: <div ng-click="on()" class="g

ios - How to get the information stored in the hls playlist CHARACTERISTICS field from the avplayer -

i´m trying guess if subtitle has accessibility options show information in ui layer i´m working on. i´m using apple´s example stream bipbop: https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8 that playlist has several subtitles, of them accessibility characteristics, example one: ext-x-media:type=subtitles,group-id="subs",name="english",default=yes,autoselect=yes,forced=no,language="en",characteristics="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound",uri="subtitles/eng/prog_index.m3u8" you can see has following characteristics: characteristics="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound" from app point of view i´m retrieving subtitles piece of code: avmediaselectiongroup * subtitleselectiongroup = [asset mediaselectiongroupformediacharacteristic: avmediacharacteris

Titanium Studio : Error loading Android SDK -

Image
i have installed titanium studio , works fine ios sdk. have downloaded android sdks , configured same in titanium studio. shows me "internal error occurred while loading android sdk.". don't know how figure out issue , unable find appropriate solution on google. screenshots both error , sdk installation attached. titanium studio, build: 3.2.3.201404181442

performance - Avoid unnecessary function calls in JSF -

how can avoid calling function on bean more once if have several html elements call function in rendered attribute? <h:outputtext value="1" rendered="#{mybean.myfunc() eq 70}"/> <h:outputtext value="2" rendered="#{mybean.myfunc() eq 42}"/> here, second outputtext unnecessarily call myfunc() again. possible avoid behavior? this answer balusc provides nice way set , reuse variables in jsf.

c - sending unicode over TCP sockets, what about endianness -

i read string unicode symbols (utf8) in c. ones read stored in 3 bytes, these characters can't stored in single byte, i'm worried endianness of these when sent on tcp socket using functions write , read. need particular them make sure machine reads stream interprets these unicode characters correctly? send byte array. endianness should not issue utf8 encoded strings, since byte oriented. endianness matters example when have 2 bytes , need interpret them single value. if have interpret these 2 bytes individually, endianness not issue. more info: http://unicode.org/faq/utf_bom.html q: utf-8 encoding scheme same irrespective of whether underlying processor little endian or big endian? a: yes. since utf-8 interpreted sequence of bytes, there no endian problem there encoding forms use 16-bit or 32-bit code units. bom used utf-8, used encoding signature distinguish utf-8 other encodings — has nothing byte order. [af]

java - Performance issues using LocalValidatorFactoryBean -

i'm trying understand why program's execution time long. aim of program import csv data, , validate line line. it appears 90% of execution time spent validation of data. validation function : public static <t> hashset<constraintviolation<t>> validate(validator validator, t resource, class<?>... groups) { return (hashset<constraintviolation<t>>) validator.validate(resource, groups); } and validator use localvalidatorfactorybean, imported in spring : <bean id="validator" name="validator" class="org.springframework.validation.beanvalidation.localvalidatorfactorybean"/> i noticed validation taking more , more time @ every iteration... example, if i've got 1000 similar lines on csv file, first validated in ~55ms, , last in ~900ms. i have no idea how explain non-linear execution time, , how improve : did mistake ? should configure bean differently ? should use other validator (which one?

ios - IBM Test Workbench for Worklight - Compound test is not executing all tests -

i'm using ibm mobile test workbench worklight 8.6.0 test hybrid app ios. i'm using iphone 4s ios 7.0.4, , i'm experiencing following problems: 1 - i'm trying run compound test 4 tests 2 tests executed. basically, after finnishing second test iphone stays in passive mode , app not started. 2 - before second test of compound test started pop-up appears asking "open page in {appname}". there way prevent pop-up appearing? 1 - i'm sorry have not yet experienced such issue compound test. 2 - issue known issue occurs safari. 2a) if on ios device, use web browser such chrome in order connect workbench. 2b) if working on ios simulator can use native client instead web one. find rtwios application , installation script in downloaded archive. in order download archive, launch safari on mac , browse workbench url + "/mobile" (i.e: http:// (mtww-ip-address) : (port-number) /mobile best regards, alexandre.

java - Hibernate persitantBag class not found -

while trying deploy war file in tomcat 7, exception occur everytime java.lang.classnotfoundexception: org.hibernate.collection.persistentbag . although using hibernate 4.3.2 jar file , class in other package (inside org.hibernate.collection.internal.persistentbag) in new version of hibernate jar file. can 1 please let me know why searching file in package? have checked pom file , there no file related older hibernate version. here stack trace : nov 18, 2014 4:17:08 pm org.apache.catalina.session.standardmanager doload severe: classnotfoundexception while loading persisted sessions: java.lang.classnotfoundexception: org.hibernate.collection.persistentbag java.lang.classnotfoundexception: org.hibernate.collection.persistentbag @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1720) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ java.lang.class.forname0(native method) @ java.lang.class.forn

java - Can I use multiple xhtml pages in the one xhtml page and how to access(references to them ) those in manged bean class? -

1)how include many xhtml pages in 1 xhtml page 2) how references them in managed bean class you need try this <ui:include src="/page.xhtml"> <ui:param value="value" name="name" /> </ui:include> here, ui:param used pass parameter.

Finding the supremum of two images in opencv -

does know hot supremum 2 images in opencv? instruction trying find, in matlab like: a = max(i, j); where , j images. it exactly same in opencv: mat i,j; mat = cv::max(i,j);

error response with Json request to Disqus on Volley (Android) -

Image
i trying connectt disqus their api (specifically calling post https://disqus.com/api/oauth/2.0/access_token/ ) i using jsonobjectrequest volley library network calls. response consistently error code 400: 11-19 12:48:17.119: e/volley(16124): [107902] basicnetwork.performrequest: unexpected response code 400 http://disqus.com/api/oauth/2.0/access_token/ i have tried proxy request in charles see more info, , got error message: and request recorded charles (as can see did add parameter grant_type ): i calling same request in ios version of app, , using same keys , information, , works there. why assume problem somewhere in code, perhaps in way add/encode/not encode parameters... code use send request: string url = "http://disqus.com/api/oauth/2.0/access_token/"; jsonobject jsonobj = new jsonobject(); try { jsonobj.put("grant_type", "authorization_code"); jsonobj.put("client_id", publickey());

how to get all data with special condition on mongodb -

how data condition discountprice not nil? if have object inside mongo db : when i'm execute query "db.products.find()", result below : { "_id" : objectid("123456778"), "items" : [ { "discountprice" : 159200, "_id" : objectid("54697e689857572459444162"), } ] }, { "_id" : objectid("847446468"), "items" : [ { "discountprice" : nil, "_id" : objectid("54697e689857572459444162"), } ] } how result : { "_id" : objectid("123456778"), "items" : [ { "discountprice" : 159200, "_id" : objectid("54697e689857572459444162"), } ] } how that? you can use $ne operator match values "not equal" n

html - HTML5 Doctype removed height100% rendering -

this question appeared address problem solution has no effect me. below simple html example. if remove doctype declaration, page 100% height fit. added, height ignored , html renders entirely @ top of page only. can advise why? using html5 doctype there other things going on in site html5 , don't believe using strictly html4 or deprecated. <!doctype html> <html dir="ltr" lang="en"> <head> <title>layout test</title> <style media="screen" type="text/css"> .yellow {background-color: yellow;} .orange {background-color: orange;} .red {background-color: red;} .green {background-color: green;} .fixed-width100 {width:100px;} .fixed-height75 {height: 75px;} .height50percent {height: 50%;} .height100percent {height:100%;} .width100percent {width: 100%;} .table {dis

javascript - angularjs $valid not working on fields -

i new angularjs. i have 2 buttons on form , 1 save , other test connection button. <td align="left" colspan="0" > <input class="form-control" title="specifies ip address of sip trunk ethernet connection." placeholder="xxx.xxx.xxx.xxx" style="display: inline-block;display:block;white-space: nowrap;overflow: hidden;" type="text" name="pabxipaddress" id="pabxipaddress" ng-model="usersetup.pabxipaddress" required ng-pattern='patternpresent' > </td> <td> <span class="error" ng-show="(testipofficeflag || submitted) && usersetupform.pabxipaddress.$error.required"> <label style="color: red;">required!</label> </span> <span class="error" ng-show='(testipofficeflag || submitted) && usersetupform.pabxipaddress.$error.pattern

unix - why normal User can't change password of others if suid bit is set on passwd -

as per suid concept, if suid bit set on file/executable file , normal user execute command. command executed privilege of owner of file/command. suid bit set on "passwd" command , root owner of passwd. if normal user "user1" execute command 'passwd' executed root privilege. however, can change password not others. why so? suid bit doesn't make run root. merely allows make setuid system call, elevate it's privileges. passwd requires root privileges update user credentials. quite cautiously though - starts in user context, verifies stuff, , escalates privileges make system change. being set setuid doesn't have bearing on - merely allows this. if want accomplish non-root password changing should use sudo run passwd root. if want, write own command embeds setuid system call, sudo better approach.

javascript - CKEditor One instance for multiple ID's -

can use 1 configuration ckeditor multiple id's? i have config in page : var editor = ckeditor.replace('dsi3',{ toolbar : [ { name: 'basicstyles', items : [ 'bold','italic'] }, { name: 'paragraph', items : [ 'bulletedlist'] } ], width: "210px", height: "140px" }); but have past again , again different ids, instead wanna : var editor = ckeditor.replace('dsi3, dsi4, dsi5, dsi6',{ toolbar : [ { name: 'basicstyles', items : [ 'bold','italic'] }, { name: 'paragraph', items : [ 'bulletedlist'] } ], width: "210px", height: "140px" }); you can user variable options. var editor_config = { toolbar

opengl - Precision of glReadPixels when reading unsigned int -

i having problems storing , retrieving 32 bit unsigned framebuffer. max value framebuffer on intel laptop (nvidia card , ubuntu) is: 4.294.967.295 however, max value can read, reason, only: 1.040.992.698 i wondering if can tell me if doing wrong or if limitation of graphics card. i setting framebuffer this: // generate render , frame buffer objects glgenrenderbuffers( 1, &colorbufid ); glgenrenderbuffers( 1, &depthbufid ); glgenframebuffers ( 1, &framebufid ); // setup renderbuffer glbindrenderbuffer(gl_renderbuffer, colorbufid); glrenderbufferstorage(gl_renderbuffer, gl_r32ui, _viewwidth, _viewheight); // setup depth buffer glbindrenderbuffer(gl_renderbuffer, depthbufid); glrenderbufferstorage(gl_renderbuffer, gl_depth_component32, _viewwidth, _viewheight); // setup framebuffer glbindframebuffer( gl_framebuffer, framebufid ); glframebufferrenderbuffer( gl_framebuffer, gl_color_attachment0, gl_renderbuffer, colorbufid ); glfram

python - Unreliable performance downloading files from S3 with boto and multiprocessing.Pool -

i want download thousands of files s3. speed process tried out python's multiprocessing.pool , performance unreliable. works , it's faster single core version, files take several seconds multiprocessing run takes longer single process one. few times ssl.sslerror: read operation timed out . what reason that? from time import time boto.s3.connection import s3connection boto.s3.key import key multiprocessing import pool import pickle access_key=xxx secret_key=xxx bucket_name=xxx path_list = pickle.load(open('filelist.pickle','r')) conn = s3connection(access_key, secret_key) bucket = conn.get_bucket(bucket_name) pool = pool(32) def read_file_from_s3(path): starttime = time() k = key(bucket) k.key = path content = k.get_contents_as_string() print int((time()-starttime)*1000) return content results = pool.map(read_file_from_s3, path_list) # or results = map(read_file_from_s3, path_list) single process comparison pool.close() pool

html - Enclosing div is higher than containing button -

i'm trying simple notification overlay. can see code here: http://jsfiddle.net/0uaqsz57/ relevant code this: <div class="close"> <button class="btn action-link">close</button> </div> and .close { text-align: right; button { line-height: 1em; height: 1em; } } notice button on right side (nevermind bad styling..). has height of 13px, according chrome dev-tools. enclosing div (.close), has height of 18px, no (css-)padding. in firefox, button has height of 13.33 px , div height of 21px in internet explorer height of button 5.33px , enclosing div height of 18.4px so question is: 1. why this? standard allow behaviour , if so, why? couldn't find specific information on this. 2. how avoid this. setting height : 100%; would robust option, live demo shows. this because button can happily scale depending on screen size. .close { text-al

Php missing first row checkbox values in dynamic table, when inserting to mysql? -

update, have found answer, see below... dynamic table of around 70 lines, user enters order size , selects checkbox (which has value) , submits table. enters mysql fine except values of checkboxes on first line, (they 0.000), acct id , order size first line enter fine, checkboxes reason. checkbox lines 2-70 work fine. i've totally confused myself, ideas? //php start if ((isset($_post["mm_insert"])) && ($_post["mm_insert"] == "form2")) { mysql_select_db($database_demo_db01, $demo_db01); //loop through input values ($i = 0, $len = count($_post['demo_acct_id']); $i < $len; $i++) { //this trims empty value lot_size column if(trim($_post['lot_size'][$i]) !== ''){ $insertsql = sprintf("insert demo_order (demo_acct_id_fk, demo_order_size, demo_order_symbol, demo_order_bid, demo_order_ask) values (%s, %s, %s, %s, %s)", getsqlvaluestring($_post['demo_acct_id'][$i

python - Function testing for primes not working as needed -

it's supposed find out if given input prime number or not. def is_prime(x): if x <= 1: return false elif x == 2 or x == 3: return true else: n in range(2, x-1): if x % n == 0: return false else: return true but is_prime(9) gives true should return false . i can't find bug, need help. you return true moment find factor doesn't divide x evenly. 2 doesn't divide 9 return true then: >>> x = 9 >>> n = 2 >>> if x % n == 0: ... print false ... else: ... print true ... true you need return true when determined no factors exist, outside loop: for n in range(2, x-1): if x % n == 0: return false return true you don't need test x - 1 , testing int(x ** 0.5) + 1 enough (so square root): def is_prime(x): if x <= 1: return false if x in (2, 3): return true n in range(2

c# - MVC 5 not validating StringLength attribute properly -

i'm trying validate sortcode field in personpaymentdetails model view failing validate stringlength(6). if submit form value of length 1 incorrectly validates successfully. am doing fundamentally wrong here? /* [controller] */ public class personcontroller : controller { [httpget] [route("person/paymentdetails/create/{personid?}")] public actionresult paymentdetailscreate(int? personid) { if (personid == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } person person = db.people.find(personid); if (person == null) { return httpnotfound(); } personpaymentdetailsviewmodel personpaymentdetailsvm = new personpaymentdetailsviewmodel(); personpaymentdetailsvm.setperson(person); return view(personpaymentdetailsvm); } [httppost] [route("person/paymentdetails/create")] public actionresult paymentdetailscreate(personpaymentdetailsviewmodel person

osx - How can I display multiple dock items for jFrames within one Java application? -

i have modular java application: single jar launches 'control panel', user can open several modules. each module uses own jframe. (a discussion of whether or bad practice can found here - in case modules talk 1 perform different functions). running on windows, each module (jframe) gets own icon on taskbar, , selectable via alt-tab. on os x 1 dock icon , 1 icon in application switcher (cmd-tab). makes quite awkward switch between modules, several of open @ 1 time. how can put each module (jframe) in os x dock , application switcher separately? iterestingly, if iconise 1 of jframes, appear in dock, in right-hand area trash. i testing using java 7 on os x 10.10 (yosemite). have made cheat's .app launches jar via shell script, in order provide cmd-line arguments (xdock:name etc) , icons - have info.plist file. you can't. os x user interface doesn't work way. iterestingly, if iconise 1 of jframes, appear in dock, in right-hand area trash.

xsd - Bulk download of wsdl and schemas(SoapUI export definition) -

we mantaining java project consumes lot of different web services. service definitions change regularly , new services added often. need automate generation of java clients. we have batch script downloads(curl) needed wsdls , dependent schemas, generates corresponding java clients(wsimport) , generates jar includes clients , wsdls , xsds which. deploy jar in our artifactory , use in our project. need include wsdls , xsds in our jar avoid jax-ws calls wsdls in execution. the script has become monster, because use different web services. every wsdl, has it's own different schemas located in different urls, have identify files have downloaded , put xsds in correct path in disk. our goal have script that, given wsdl url list, downloads wsdls , dependent xsds in folder can execute wsimport against them. soapui's "export definition" tool, exports wsdld , dependent schemas in folder, , modifying "ws:import" paths in wsdl automaticaly. there way invoke t

c# - correct output for enum intilization -

i declare enum enum month { january , february , march , april , may , june , july , augest , september , octobre , november , december } then in main prog static void dowork() { // month first = month.january; console.writeline("first month of year : {0}", first); first++; console.writeline((int)first); } the output on seond line should 2 but 1 what problem ( pass value issue or somthing else ) by default, first item in enum '0', each item incrementing 1 . can assign values manually, however, , should fix issue you. note that, in case, setting first item 1 should trick, can specify value , of them: enum month { january = 1, february , march , april , may , june , july , augest , september , octobre , november , december }

python - Django field refering to another field -

i'm make django model conditions. i've thought these fields class condition(models.model): model_name = charfield(max_length=100) field_name = charfield(max_length=100) value = charfield(max_length=100) so can create condition specific field ( field_name ) in specific model ( model_name ) equal value . thought there might solution already? instead of using field_name thought if possible refer directly field either through contenttype or else? i know high level , code not model asking. simple examples django signals determine when change happened. https://docs.djangoproject.com/en/dev/topics/signals/ here signals.py file in app managing person objects when users change: from django.db import models anotherapp.models import * def user_post_delete(sender, instance, **kwargs): try: if instance.username: person_item = person.objects.get(username = instance.username) person_item.django_user = none

javascript - Remove DOM element on refresh -

i have code lottery game offices' christmas party. because have 0 knowledge jquery , minor skills in javascript, googled , found neat little script (see code below). how can remove winner list when refreshing page? possible read .remove() jquery. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>auslosung</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!-- jquery einbinden --> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> /* wenn der body geladen ist werden die enthaltenen funktionen ausgeführt. $(document).ready(function(){ ... }); alle in dieser enthaltenen funktionen werden entsprechd erst bei geladenem body ausgeführt */

python - Why is selenium giving NoSuchElementException when element definitely exists -

i'm having problem selenium giving me nosuchelementexception when element exists without doubt. below 1 example doesn't find element , times out. know element given id exists because can see in source while program running reason selenium can't find it. doesn't throw error in case same problem elsewhere in code throw errors. i have tried using xpath instead of id using implicit waits before trying find still doesn't work. def waitforload(id): checktime = 0 while true: try: x = webdriver.find_element_by_id(id) return true except: time.sleep(0.5) checktime += 0.5 print(checktime) if checktime > timeout: return false known issues: 1.iframe 2.even if element have id, must unique, engines can generate 2 or more elements same id. check that! 3.maybe element have hidden clone if input etc. also, check that!

How to pull the column name in to the data in SAS -

the table date variable name respect vol , want create new variable flag if variables having 1 pull date of variable name in flag column vol 31-dec-10 31-dec-11 31-dec-12 31-dec-13 31-dec-14 31-dec-15 109001 0 0 0 0 1 0 109002 0 0 1 0 0 0 109003 0 0 1 0 0 0 109004 0 0 0 1 0 0 109006 0 0 1 0 0 1 output vol 31-dec-10 31-dec-11 31-dec-12 31-dec-13 31-dec-14 31-dec-15 flag 109001 0 0 0 0 1 0 31-dec-14 109002 0 0 1 0 0 0 31-dec-12 109003 0 0 1 0 0 0 31-dec-12 109004 0 0 0 1 0 0 31-dec-13 109006 0 0 1 0 0 1 31-dec-15 you want use vlabel() function since column headings don't meet standard variable name requirements , i'm assuming they're labels. below example code put in data step, you'll have know actual variable names array declaration , replace date1--date99 them. array mydates (*) date1--date99; on

algorithm - Find the maximum hyperrectangle contained in a set of points -

Image
i have question similar 1 ( find largest rectangular block satisfying condition without iterating explicitly ). in case have multidimensional (up 6 dimensions) binary array , want find largest hyperrectangle (by volume, i.e. product of dimensions) contains 1's. for example, in 3d, data like: data = table[if[i - j - k <= -1, 1, 0] , {i, 11} , {j, 11} , {k, 11} ]; http://i.imgur.com/brgiuoq.jpg note i'm looking algorithm, , doesn't have written in mathematica.

Optionally pass argument to subprocess in python -

in script call executable optional command line argument (if passed, argument switches on function in executable, off default). want control option directly argument of script itself. write do: import subprocess option = false if option: check = subprocess.popen(['executable', '--option']) else: check = subprocess.popen(['executable']) i tried find more compact way: import subprocess option = false check = subprocess.popen(['executable', '--option' if option else '']) but raises error "unknown option" in exactable itself. and raises error in python: import subprocess option = false check = subprocess.popen(['executable', '--option' if option else none]) so, question: there way pass optional argument subprocess in 1 line? using list slicing: >>> ['executable', '--option'][:1 + false] ['executable'] >>> ['executable', '--opti

.net - Content-based routing in MassTransit -

is possible content-based routing in masstransit? practice use enterprise service bus content-based routing? generally content-based routing frowned upon (e.g. http://www.udidahan.com/2011/03/20/careful-with-content-based-routing/ ) , not considered practice. masstransit not support content based routing. routing done on types. given that, have done implementation specific product had content based routing done custom distributor implementation on msmq. take content "slow lane" during load balancing process. narrow , scope , deems okay specific needs. time i've used though - proper use of message types routing easier maintain , manage.

git - Rails 4 - capistrano 3 doesn't deploy last commits -

This summary is not available. Please click here to view the post.

Running CGI Python Javascript to retrieve JSON object -

i want use javascript retrieve json object python script ive tried using various methods of ajax , post cant working. for have tried set this my javascript portion: have tried $.post('./cgi-bin/serverscript.py', { type: 'add'}, function(data) { console.log('posted: ' + data); }); and $.ajax({ type:"post", url:"./cgi-bin/serverscript.py", data: {type: "add"}, success: function(o){ console.log(o); alert(o);} }); my python import json import cgi import cgitb cgitb.enable() data = cgi.fieldstorage() req = data.getfirst("type") print "content-type: application/json" print print (json.jsonencoder().encode({"status":"ok"})) i getting 500 (internal server error) have tried doing just print (json.jsonencoder().

c# - Error 26 ambiguous reference VS2012 -

error 26 'productfact' ambiguous reference between 'adcheck.servicereference1.productfact' , 'sladcheckbusinnesobjects.facts.productfact' d:\factory\factory code\bmi\adcheck\adcheck\controls\contents\captureproductvolumesperpack.xaml.cs ‌​41 62 adcheck using sladcheckbusinnesobjects.products; using sladcheckbusinnesobjects.facts; namespace adcheck.controls.contents { public partial class captureproductvolumesperpack : securityenabledpage { private list<productfact> newproductfacts = new list<productfact>(); public captureproductvolumesperpack() { initializecomponent(); innerlayoutrootheader.ishittestvisible = false; page p = application.current.rootvisual page; if(p != null) // p page usercontrol. { } productfact ambiguous, need qualify either sladcheckbusinnesobjects.facts

asp.net - jQuery Dialog with internal asp:Button dont want it to close the dialog -

question: how stop asp:button lives inside aspx page displayed inside jquery dialog closing dialog. want keep dialog open , use info input form database table work with. i have simple demo code behind adds 2 numbers (very crude , elementary) , when hit 'button' add numbers closes dialog box. adds numbers dialog box closes. calling dialog: <script> function showdialog() { var mydiv = $("#dialog-form").dialog({ modal: true, autoopen: false, height: 500, width: 500 }); mydiv.load('effortsubmittalpage.aspx'); $("#dialog-form").parent().appendto($("form:first")); mydiv.dialog('open'); return false; } </script> content page displays in dialog: <asp:content id="headercontent" runat="server" contentplaceholderid="h

Windows server 2003 Service Pack 2 install error -

when tried install service pack 2 on server windows server 2003 had error: service pack 2 setup error windows server 2003 service pack 2 cannot install. product key used install microsoft windows may not valid more information why have received error message, , steps can take resolve issue visit www.howtotell.com. any help? regards, roie.

android - How to make application run portrait in phone and landscape on tablets -

hi looking learn these can give more layouts , ui exp of application. want app must run in portrait mode in case of phone can set in androidmanifest.xml <activity android:name=".splashactivity" android:label="@string/title_activity_splash" android:screenorientation="portrait"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> but keep phones , tablet. if way of course layout won't on 7 , 10 inch screens. question how set such app run in portrait mode in mobile phones , landscape mode on 7 , 10 inch screens. thanks in advance. create new file named bools.xml in values folder below: <?xml version="1.0" encoding="utf-8"?> <resources> <item type="bo

c# - forcing xslt to use version 2 with xslCompiledTransform -

i have following xslt , need use xslt version 2.0 functions 'format-date'. how declare xsl sheet use version 2.0 using xsltcompiledtransform class (c#, .net 4.5). <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="http://www.w3.org/tr/xhtml1/strict" xmlns:msxsl='urn:schemas-microsoft-com:xslt' xmlns:var='urn:var' xmlns:js='urn:js' > <xsl:output method="html"/> <xsl:variable name="n" select="1"/> <xsl:template match="/newdataset"> <html> <head> <style> table{border-collapse:collapse;font-family:"verdana";} table,td{border:1px solid black;color:black; background-color:white;font-family:"verdana";} table,th{border:1px solid balck;background-c

mongodb - How to properly configure multi datacenters replica set members for efficient dc crash handling and write ack? -

considering mongodb replica set 5 members using 3 datacenters. dc1 hosts 2 members (r1,r2), primary , secondary dc2 hosts 2 members (r3,r4), 2 secondaries dc3 hosts 1 arbiter i use approppriate write concern : to able continue writing data if datacenter lost but have write done on both datacenters before ack when both dc up. using following distribution please tell me if i'm wrong these expectations : using w:3 data written @ least 1 host of dc2, if datacenter goes down write blocked indefinitely, waiting third replica goes up. can't use w:3. using w:majority, considering 'majority' computed using replica set members defined in configuration , not ones up/joignable after change in set due data center down, write block, in previous w:3 case. can't use w:majority. using w:2, data written primary , replicated on nearest secondary, on same datacenter. using w:eachdc work when dc up, when 1 dc goes down write blocked. how configure members

Remove xA0 from powershell string -

i see few articles on removing xa0 character string in python, i'm not unfamiliar with, tips there not seem work powershell. my problem i'm parsing excel file did 'ctrl+space' , created xa0 invisible character. i've removed excel sheet, i'm interested in knowing how filter/remove out these characters in general. it causes problems when exporting these strings xml (doesn't characters). if non-breaking space, can use -replace operator replace it: ps c:\> $s = [string]::join([char]0x00a0, ('hello','world')) ps c:\> $s hello world ps c:\> $s -replace [char]0x00a0,'-' hello-world you might want replacement after creating xml: ps c:\> ([psobject]@{"name"=$s} | convertto-xml -as string) -replace [char]0xa0,'&#160;' <?xml version="1.0"?> <objects> <object type="system.collections.hashtable"> <property name="key" type="system

insert a block to xml file java -

<?xml version="1.0" encoding="utf-8"?> <dbvisualizer> <databases> <database id="1"> <alias>mymssqlserver</alias> <url /> <driver>sql server (jtds)</driver> <userid>db_monitor</userid> <profile>auto</profile> <type>sqlserver</type> <password>abcdefghsifjsdsdkjsd</password> <serverinfoformat>1</serverinfoformat> <autodetecttype>true</autodetecttype> <properties> <property key="dbvis.connectionmodemigrated">true</property> </properties> <urlformat>0</urlformat> <urlvariables> <driver> sql server (jtds) <urlvariable urlvariablename="server">192.168.1.1</urlvariable> <urlvariable urlvariablename="

authentication - Laravel Auth::attempt Expiring session -

i have come across strange problem after login via auth::attempt() session expires. i using following code route::post('user/auth', function(){ if (auth::attempt(array('email' => 'email@yahoo.com', 'password' => 'some password','user_status'=>'active'))) { $userid = auth::id(); } }); every time run call user/auth , session values destroyed , new token set laravel. happening on hosting server. while on local computer working fine. please have invested 2 days finding problem. i have set links explaining:-- on following link using auth::attempt while displaying of session variables. please notice _token. page set session variables being destroyed. http://behungry.co.in/set/session on following page calling session::all() display sessions. please check _token variable here. both different. while expecting them same , persist sessions. http://behungry.co.in/get/sessions following