Posts

Showing posts from July, 2012

javascript - Run Websocket on GAE -

Image
i'm trying adapt app using websocket run on gae, reading docs, i'm not find pretty solution problem. using simple application that: https://github.com/marcosbergamo/gae-nodejs-websocket this sample demo trying use. i'm receive error when try connect websocket; follow image request; in order use websockets, must use google managed vm custom runtime. https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes once running, need access server directly ip or cname. cannot go through appspot.com domain.

.net - Peer Not Authenticated: REST Service Error using WizTool -

i using wiztool.org's restclient v3.4.2 test remote .net endpoint on windows 2012 box, iis 8.0. i've used tool many times debug same rest services on local machine in debug mode, first time i've tried use on actual production server. (well, it's qa server, close enough.) main difference between i've done in past , on local dev box, don't have ssl cert, done http url. on qa server, have cert, i'm using https. i getting error: peer not authenticated javax.net.ssl.sslpeerunverifiedexception: peer not authenticated @ sun.security.ssl.sslsessionimpl.getpeercertificates(unknown source) @ org.apache.http.conn.ssl.abstractverifier.verify(abstractverifier.java:128) @ org.apache.http.conn.ssl.sslsocketfactory.connectsocket(sslsocketfactory.java:339) @ org.apache.http.impl.conn.defaultclientconnectionoperator.openconnection(defaultclientconnectionoperator.java:123) @ org.apache.http.impl.conn.abstractpoolentry.open(abstractpoolentry.ja

magento - PHP ob_gzhandler extra characters -

Image
i have blended website have expressionengine cms magento store. in our ee site, have template call plugin retrieve store cart info. use magento's authentication logged in user magento user. we want show this: the code in plugin connects magento, gets loggedin user, if logged in , sets number of cart items. this html plugin supposed return template: <span class="carticon">(0)</span><a href="http://www.example.com/store/checkout/cart/">my cart</a><span>welcome, mb34!</span><a href="http://www.example.com/store/customer/account/logout/">logout</a> but, if enable gzip on expressionengine, err_content_decoding_failed exception because magento doesn't have built-in gzip. not have mod_deflate enabled how ee able gzip? has through ob_gzhandler. now, if modify plugin use ob_gzhandler this: ob_start("ob_gzhandler"); echo trim($result); ob_end_flush(); i characters @ end of outpu

Good practices for Rails website with lots of photos -

i have website tons of photos, , displays them right when visit it. best practices displaying these photos within rails app. i have done typical uploading aws, , resizing using paperclip. looking other gems out there or servers website load faster, etc. split asset loading amongst multiple hostnames. create assets0, assets1, assets2, , assets3 cnames point website. add config/environments/production.rb : config.action_controller.asset_host = 'https://assets%d.yourdomain.com' config.action_mailer.asset_host = 'https://assets%d.yourdomain.com' assets loaded 1 of 4 cname's. trick browsers running more requests simultaneously browsers limit number of simultaneous requests single server. see here more: http://api.rubyonrails.org/classes/actionview/helpers/asseturlhelper.html http://www.die.net/musings/page_load_time/

How does Ruby's OptionParser work? -

"minimal example" of optionparser http://ruby-doc.org/stdlib-2.1.5/libdoc/optparse/rdoc/optionparser.html : require 'optparse' options = {} optionparser.new |opts| opts.banner = "usage: example.rb [options]" opts.on("-v", "--[no-]verbose", "run verbosely") |v| options[:verbose] = v end end.parse! p options p argv main questions: what content of opts there? new optionparser instance, or of /-\w/ or /--\w+/ -looking things passed script? corollary, do block loop or not? what parse! do? why called on whole do block? also wondering: what optionparser#banner method? in context see text? in context see third parameter passed optionparser in example, little description of flag's effect? how can create custom error message if script run unknown option? opts new instance of optionparser . block supplied .new run line: yield self if block_given? parse! same thing parse destructi

c# - Display image dynamically with ViewBag -

i want display , change image dynamically in same view. have tried use code: use mvc 3 viewbag dynamically change image and this: pass image controller , display in view using viewbag in asp.net mvc 3 but didn't work. here index.cshtml : @using (html.beginform("showfile", "home", formmethod.post, new { enctype = "multipart/form-data" })) { @html.textbox("imageid") <input type="submit" value="ok" class="submit" /> } <img src="@viewbag.foto" alt="images" /> my homecontroller.cs : public actionresult index() { return view(); } public actionresult showfile(string imageid) { var dir = server.mappath("/images/profile"); var path = path.combine(dir, imageid + ".jpg"); if (system.io.file.exists(path)) { viewbag.foto = path.tostring(); } return redirecttoaction("index", "home"); }

url rewriting - IIS URL rewrite is redirecting instead -

goal using iis 7.5 , url rewrite 2.0 module, want rewrite relative path "/myapp" "/myapp-public", without browser redirection. what i've tried i placed following web.config file in wwwroot: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> </system.web> <system.webserver> <rewrite> <rules> <rule name="rewrite public" stopprocessing="true"> <match url="^myapp" /> <action type="rewrite" url="/myapp-public" /> </rule> </rules> </rewrite> </system.webserver> </configuration> problem instead of rewriting url on server side, iis responds "301 moved permanently" redirects user "/myapp-public". behaving if had used action of type &quo

c++ - cant output my whole file -

if(inputfile.is_open()){ while(!inputfile.eof()){ getline(inputfile, line); ss << line; while(ss){ ss >> key; cout << key << " "; lineset.insert(linenumber); concordance[key] = lineset; } linenumber++; } } for reason, while loop kicking out after first iteration , displays first sentence of input file. rest of code works fine, cant figure out why thinks file has ended after first iteration. thanks firstly should reading file without using eof , πάντα ῥεῖ notes (see here explanation): while( getline(inputfile, line) ) { // process line } note preceding if not necessary either. the main problem , assuming ss stringstream defined earlier, comes logic: ss << line; while(ss){ // stuff } the while loop here exits when ss fails. never reset ss in state. although

python pandas : decimal point after integer? -

i'm going through pandas tutorial, , came across haven't seen before. there decimal point after integer. here's gist link tutorial: https://gist.github.com/findjashua/82717d2f3261a92ce528 what purpose of decimal point after integer?. i think makes float instead of int shown below: in [1]: type(5) out[1]: int in [2]: type(5.) out[2]: float

c++ - Connecting sockets over different servers -

i have can connect client , server using same server, can't if on different ones. i'm new realm of things , don't understand why or how change this. i'm guessing having same port# doesn't if on different servers , there else needed. help! edit: if it's of relevance i'm connecting 127.0.0.1

algorithm - Hamming weight of an interval -

my task calculate number of 1-bits of interval [1,10^16]. loop unusable case, , i've heard there exists algorithm this. can help? more generally, algorithm number of 1-bits in interval [1,n] nice. if helps, figured number of 1-bits of interval [1,2^n-1], n positive integer, n*2^(n-1). the number of 1-bits in interval [1,n] number of 1-bits in interval [1,2^m] plus number of 1-bits in interval [1,n-2^m] plus n - 2^m. m ⌊log(n)/log2⌋.

ios - using Swift to get contents of URL using NSURLSession, however, it return errors -

i've got 3 errors, "'nearbyvc.type' not confirm protocol 'uitableviewdatasource'" @ error1, "'nearbyvc.type' not have member named 'session'" @ error2 , "expected declaration" @ error3. however, cannot figure out why such errors appeared.if know hot solve, please me. // ※error1※ class nearbyvc: uiviewcontroller,uitableviewdelegate,uitableviewdatasource{ @iboutlet var listview: uitableview? var tabledata = [] override func viewdidload() { super.viewdidload() // additional setup after loading view. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func tableview(tableview: uitableview,numberofrowsinsection section: int) -> int{ return 1 } func tableview(tableview: uitableview,cellforrowatindexpath indexpath: nsindexpath) -> uitableview{ let cell:uitableviewcell = uitableviewcell(style: uitableviewcellstyle.subtitle,

windows - Why can a double clicked batch file not find a registry value for deletion? -

i wrote bat file delete registry entry. reg delete hkey_local_machine\software\microsoft\windows\currentversion\run /v value /f when execute in cmd, works. but when execute double click, doesn't!!! error message: error: system not find specified registry keys or values anyone else can tell me why! on 64-bit windows there automatic start of 64-bit applications hkey_local_machine\software\microsoft\windows\currentversion\run and automatic start of 32-bit applications hkey_local_machine\software\ wow6432node \microsoft\windows\currentversion\run if batch file executed 32-bit cmd.exe in directory %systemroot%\system32\ being automatically redirected 32-bit applications %systemroot%\syswow64\ , registry path hkey_local_machine\software\microsoft\windows\currentversion\run is automatically redirected to hkey_local_machine\software\ wow6432node \microsoft\windows\currentversion\run if batch file executed 64-bit cmd.exe in directory %systemroot%\

How print qr code in epson tm-t88v from php -

i try print qr code in epson pos tm-t88v form php , can't. information epson-biz.com no clear @ all, , search , no example correct steeps print qr code. print text no problems, qr code no work. code tri follow epson documentation esc-pos: if(($handle = @fopen("lpt1", "w")) === false){ die('i can't print, check connection'); } fwrite($handle,chr(27). chr(64));//restart fwrite($handle, chr(27). chr(100). chr(0)); fwrite($handle, chr(27). chr(33). chr(8)); fwrite($handle, chr(27). chr(97). chr(1)); fwrite($handle,"================================="); fwrite($handle, chr(27). chr(100). chr(1)); fwrite($handle, chr(27). chr(32). chr(3)); fwrite($handle," no 1005 "); fwrite($handle, chr(27). chr(32). chr(0)); fwrite($handle, chr(27). chr(100). chr(0)); fwrite($handle, chr(27). chr(33). chr(8)); fwrite($handle, chr(27). chr(100). chr(0)); fwrite($handle, chr(27). chr(100). chr(1)); fwrite($handle,"====================

using the form module in python django -

in django there form module , inside there form class from django import forms class myform(forms.form): name = forms.charfield() but if did: from django.forms import form class myform(form): name = ?? my question if form class inside module form , inheriting then while creating forms why have explicitly call forms.charfield() . its 'coz charfield class exists in forms.fields, have import forms write forms.charfield.you can write this: from django.forms.fields import charfield take @ file https://github.com/django/django/blob/master/django/forms/fields.py

node.js - npm install canvas dies with "clang: error: no such file or directory: '{{}'" -

i error while installing node packages run node-gyp rebuild : solink_module(target) release/canvas-postbuild.node clang: error: no such file or directory: '{{}' make: *** [release/canvas-postbuild.node] error 1 gyp err! build error gyp err! stack error: `make` failed exit code: 2 gyp err! stack @ childprocess.onexit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp err! stack @ childprocess.emit (events.js:98:17) gyp err! stack @ process.childprocess._handle.onexit (child_process.js:810:12) gyp err! system darwin 14.0.0 gyp err! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp err! cwd /users/arkadiy/node-canvas gyp err! node -v v0.10.33 gyp err! node-gyp -v v1.0.1 gyp err! not ok i have npm 1.4.28 , of /usr/local chowned me. clang recent-ish: apple llvm version 6.0 (clang-600.0.54) (based on llvm 3.5svn) target: x86_64-apple-darwin14.0.0 threa

How do I apply text justify on Bootstrap alerts -

Image
i'd ask how justify (right , left aligned) text inside bootstrap alerts. tried use class text-justify alert classes not text justified. code follows: <div class="alert alert-danger alert-error text-justify"> <a href="#" class="close" data-dismiss="alert">&times;</a> <span class="glyphicon glyphicon-remove-circle"></span> lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque scelerisque enim non dolor blandit lobortis. aenean risus elit, porta eu consectetur vel, mollis ut risus </div>. so far, i'm getting output below: thanks link bootply : http://www.bootply.com/d3oen9glog change code , see. <div class="alert alert-danger alert-error text-justify"> <div class="container"> <div class="row"> <a href="#" class="close" data-dismiss="alert">&times

java - Android aviary converting to fragment -

how can convert code below can work in fragment. @override protected void onresume() { log.i( log_tag, "onresume" ); super.onresume(); if ( getintent() != null ) { handleintent( getintent() ); setintent( new intent() ); } } i have tried this. doesn't worked. public void onresume() { log.i( log_tag, "onresume" ); super.onresume(); if ( getactivity().getintent() != null ) { handleintent( getactivity().getintent() ); getactivity().setintent( new intent() ); } }

Connecting Android with Oracle server -

i trying connect android application oracle12c sql server through jdbc. android don't find oracle.securitypki , javax.management class files while loading jdbc. , checked these class files don't exist in jdbc driver. please can me how can make connection possible using jdbc. , want mention have included internet permission in android manifest file. here code: import android.os.bundle; import android.widget.textview; import android.app.activity; import java.sql.*; import java.sql.connection; import java.sql.drivermanager; public class mainactivity extends activity { textview text; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); text=(textview)findviewbyid(r.id.txt_2); connection conn=null; string url="jdbc:oracle:thin:@192.168.1.16:1521:mydatabase"; string username="system"; string password=&q

ruby - Where do methods defined at the top-level exist? -

i learning metaprogramming , stuck trying find method. let's have following class: class myclass def self.my_method end def your_method end end with following code can search each method in object space: type = class name = /^my_method$/ result = objectspace.each_object(type).select |o| o.instance_methods(false).grep(name).size > 0 || o.methods.grep(name).size > 0 end p result and finds showing following output: [myclass] as searcher code searches instance methods, shows same output when looking your_method. even if add singleton method object: mc = myclass.new def mc.our_method end just changing searcher this: type = object name = /^our_method$/ result = objectspace.each_object(type).select |o| o.methods.grep(name).size > 0 end p result it finds it: [#<myclass:0x8f86760>] the question is, how find method defined in top level object? method: def hidden end besides, current class when defining method this? whic

uitableview - Trouble adding buttons to UITableViewCell in Swift -

how can add uibutton uitableviewcell? having trouble doing in storyboards. the problem prototype cell style can modify in xcode custom style. make setting in cell's attributes inspector , well. i made little screencast demonstrates: http://youtu.be/bn-nbogfl00 note there 2 different things cell can important here: style (in attributes inspector) , class (in identity inspector). totally different things , have no relation 1 (they "orthogonal", say). said earlier makes me think may confusing them each other...!

How to post a json for a particular parameter using CURL -

i try post request contains number of parameters. 1 parameetr require json file. tried several options face issue json. parameter requires json 'swagger' .. here curl request try.[1] looks not accepted server. im getting following error; "null not supported"}curl: (6) not resolve host: swaggerimpl.json how can post json using curl particular parameter? [1] curl -x post -b cookies $server/publisher/site/blocks/item-design/ajax/add.jag -d "action=implement&name=youtubefeeds&visibility=public&version=1.0.0&provider=admin&endpoint_type=http&implementation_methods=http&wsdl=&wadl=&endpointtype=nonsecured&production_endpoints=http://gdata.youtube.com/feeds/api/standardfeeds&implementation_methods=endpoint" -h 'content-type: application/json' -d 'swagger=' @swaggerimpl.json edit : curl command curl -x post -b cookies $server/publisher/site/blocks/item-design/ajax/add.jag -d "action

python - How to open html file? -

i have html file called test.html has 1 word בדיקה . i open test.html , print it's content using block of code: file = open("test.html", "r") print file.read() but prints ?????? , why happened , how fix it? btw. when open text file works good. edit: i'd tried this: >>> import codecs >>> f = codecs.open("test.html",'r') >>> print f.read() ????? import codecs f=codecs.open("test.html", 'r') print f.read() try this.

symfony - Export of large amounts of data with JMSSerializerBundle -

if try export large amounts of data "jmsserializerbundle" following error. fatalerrorexception: error: allowed memory size of 134217728 bytes exhausted (tried allocate 1332351 bytes) in /var/www/app/trunk/vendor/symfony/symfony/src/symfony/component/httpkernel/datacollector/datacollector.php line 27 if export few records bundle, works fine. $format = 'json'; $serializer = \jms\serializer\serializerbuilder::create()->build(); $serializer->serialize($data, $format, serializationcontext::create()->enablemaxdepthchecks()); the count of array $data 1917 how can handle issue? try somewhere in script a: echo ini_get('memory_limit'); // see how memory have and update memory_limit settings in php.ini file. restart server , try again.

php - how to replace email address from html innertext -

i have problem, replacing email address html innertext. i can replace email address. can't replace specific(innertext of html). please me.. i have tried preg_replace('/[a-z0-9._%+-]+@([a-z0-9.-]+\.[a-z]{2,4}|[a-z0-9.-]+)/iu','[---]',$data) please me. thanks... my input <div data="example1@dom.com,example4@dom.com"><a href="example1@dom.com" > example4@dom.com, <b>example3@dom.com</b> other text, example7@dom.com, ,<i>example5@dom.com</i></a></div > expected output: <div data="example1@dom.com,example4@dom.com"><a href="example1@dom.com" > [--], <b>[--]</b> other text, [--] ,<i>[--]</i></a></div > live demo through pcre verb (*skip)(*f) . <[^<>]*>(*skip)(*f)|[a-z0-9._%+-]+@([a-z0-9.-]+\.[a-z]{2,4}|[a-z0-9.-]+) demo <[^<>]*> matches tags , following pcre verb (*skip)(*f

C/C++ code in order to store private keys in Android app -

i'm trying find best way store private keys in android app. proguard not enough , dexguard sounds nice little bit expensive me.. what important thing hiding (or hardening see) api access keys in case. result of few days try , error, found using c code looks useful. my questions are... ・do think using c/c++ way hide private keys? ・i'm using android studio. maybe can use ndk(native development kit). think ndk easier way others? (i've never used ndk) thanks, fyi how avoid reverse engineering of apk file? best practice storing private api keys in android it impossible save key safely in client app. java can decompiled easily. proguard makes harder. c++ seems harder, not impossible decompile. have aware of hackers can find key if save in client app. easiest way, open lib , try search key text. probably, see somewhere in binary file

sql - MYSQL : Find records between particular period -

i have 1 table named "checkinguestusers" in there columns 'checkintime(datetime), checkouttime(datetime),rooms(varchar) there particular user booked rooms within particular time as, userid checkintime checkouttime rooms 25 2014-12-04 00:00:00 2014-12-05 23:59:59 101,102 now user or same user wants book room within "2014-12-03 00:00:00" "2014-12-04 23:59:59" or "2014-12-04 00:00:00" "2014-12-04 23:59:59" then system should return room list except 101,102 these rooms booked "2014-12-04 00:00:00" "2014-12-04 23:59:59" i want sql query if select time 1 of above both returns rooms booked within period. i have tried using between , greater or less conditions in sql failed exact result. select room_id rooms checkintime null or checkouttime <= bookfrom , checkintime null or bookto <= checkintime is homework?

python - How to include change_view form with value -

i have book table there 1 filed value contains encrypted title , descriptions of books. now doing admin function there admin can view or edit user's submitted title , descriptions. so far drive value field in admin/users/book/5/ using custom modelform , here want show user's submitted value using extra_context know that's not showing in field. models.py class book(models.model): values = models.charfield(max_length=800, null=true, blank=true) forms.py class bookform(forms.modelform): extra_field = forms.charfield() def save(self, commit=true): value = self.cleaned_data.get('value', none) class meta: model = book admin.py class bookadmin(admin.modeladmin): def add_view(self, request, form_url='', extra_context=none): return super(bookadmin, self).add_view(request) def change_view(self, request, object_id, form_url='',): bookinfo = book.objects.get(pk=o

c# - Lags during scrolling panel with user controls -

Image
good day. i working on custom control (really it's panel gadgets) contains number of controls. in case, there instances of myembeddedcontrol : usercontrol few panels, buttons, labels , methods. behaviour of controls not matter, point have locations within custom control. problem cpu load increases 99% , crazy lags during scrolling control: normal state during scrolling i tried set doublebuffered true. there many user controls, showing area small. not understand why paint hard. may wrong , i'd better not use many controls inside custom control? best practices?

angularjs - Do asp.net mvc apicontroller requests require async handling in addition to angular $resource -

if i'm using asp.net mvc apicontrollers backing services layer , angular front-end using $resource, need use asp.net mvc async pattern? i understand $resource asynchronous , doesn't block ui, benefit using asp.net mvc's async keep server blocking requests when have many clients doing i/o intensive tasks? thanks! scott yes, benefit, these orthogonal concerns. javascript uses asynchronous i/o because single threaded default (barring web workers). how server manages incoming requests of no real concern ui ... unless of course have large number of concurrent users. asynchronous calls on server asp.net means when i/o operation has been initiated, thread can released other work. when network call, or disk read completes, server can resume processing of original request. the result web server able pack more requests same period of time if calls blocking. again, isn't tied browser, or angular in way.

javascript - How to stop slider when .mp4 video is played in mvc? -

i'm using "bxlider.js" plugin slide 1 "html<>" video , 2 image in mvc project. problem when i'm playing video, slider still sliding. here code: $('.bxslider').bxslider({ auto: true, autocontrols: true, }); <ul class="bxslider"> <li> <video id="homepagevdo" height="210" controls="controls" > <source class="video-width" src="~/media/homepagevdo.mp4" type="video/mp4"> </video> </li> <li> <img src="~/media/sample1.png" role="img" width="350" height="210" alt="sample1" title="sample1"/> </li> <li> <img src="~/media/sample2.jpg" role="img" width="350" height="210" alt="sample2" title="sample2"/> </li&

c# - How to inject dependencies via a construction delegate -

i'm using third-party library has setup structure this: iengine engine = /* singleton provided elsewhere */ var server = new fooserver(); server.addservice("data1", () => new data1(engine)); server.addservice("data2", () => new data2(engine)); server.start(); ... server.dispose(); (the lambda factory method; internally invoke whenever wants new instance own purposes.) except further complication instead of adding services directly, i'm using reflection find , register them, need defined work instead of needing explicitly listed out. wanted self-contained, constructing generic lambda methods based on reflected types seemed complicated, moment i've settled register method provided each type: class data1 : dataprovider { public static void register(fooserver server, iengine engine) { server.addservice("data1", () => new data1(engine)); } ... (constructor, dispose, other stuff) } var server = new foo

c# - set the visibility of text box to false when the rad combo box shows empty message string -

i have user control in using 1 editable rad combo , 1 rad text box. depends on value of combo need set visibility of text box. working. code follows. 1. user control <asp:panel id="pnl44" runat="server" visible="false"> <table width="100%"> <tr> <td style="width: 20%;"> quantity<span style='color: red'>* </span> </td> <td align="left" style="vertical-align: top; width: 80%;"> <table width="100%"> <tr> <td align="left" style="vertical-align: top; width: 63%;"> <telerik:radcombobox id="pnl44_ddlunit" runat="server" dropdownautowidth="enabled" width="150px" autopostback="true" on

asp.net mvc 3 - How to insert Japanese character in MySQL? -

i using mysql db , want insert first , last name in japanese , inserts "??????". stuck , have searched lot didn't solve problem. the table structure is: engine : myisam, collation :utf8_general_ci

Rails 4 different validations in one model -

i have page 2 tabs (forms), used edit 1 object. e.g. user's info. in first tab there personal info, in next tab there billing info. each form has own submit button. how can validate fields separately. if understood right, when i'll try submit form 4 fields (of 10), raise errors, other fields (6 of 10) wrong. what right way this? create 2 classes reflect ui: class user has_one :user_info has_one :billing_info end class userinfo belongs_to :user # add validation end class billinginto belongs_to :user # add validation end in controller: def edit @user = user.find(params[:id]) @user_info = @user.build_user_info @billing_info = @user.build_billing_info end then in views: = form_for @user_info |f| = form_for @billing_info |f| you'll need 2 controllers handle post requests. should named userinfoscontroller , userbillinginfoscontroller respectively.

Can I use JavaScript to change the JavaScript files a HTML document accesses? -

i trying write html page asks users series of questions. answers these questions evaluated javascript code , used determine additional javascript file user needs access. code adds additional javascript file head tag of html page. don't want merge code single javascript file because these additional files large enough nightmare if they're together, , don't want add them head when page first loads because have many variable conflicts. i'm reluctant redirect new webpage each dictionary because make lot of redundant coding. i'm not using libraries. i begin following html code: <head> <link rel="stylesheet" type="text/css" href="main.css"> <script src="firstsheet.js" type="text/javascript"></script> </head> //lots of html. <div id="mainusermenu"> </div> and have following javascript function: function thirdlevelquestions(secondlevelanswer) { //code here calc

tomcat - HAProxy - connection reset during transfer -

i using haproxy in front of 2 webapps deployed in tomcat. when testing high availability, made 10000 requests , @ point kill 1 of tomcat instances. 1 or 2 requests errors. request sent using spring's resttemplate. here exception: "org.springframework.web.client.resourceaccessexception: i/o error on post request "http://:8080/myservice/_doaction":unexpected end of file server; nested exception java.net.socketexception: unexpected end of file server" the haproxy stats says in "errors" section, "resp" subsection, when hover on number shown there, 2 : "connection resets during transfers:1 client, 2 servers". means? also, on "warnings" section have "retr":29 , "redis":1. tells me request being redispatched "living" server. assumption correct? here haproxy.cfg: listen tomcat_frontend bind *:8080 timeout client 5000ms timeout server 5000ms mode http option httpclose op

ruby on rails 4 - custom instance variable name in cancan's load_and_authorize_resource? -

users_controller.rb class userscontroller < applicationcontroller def index @objects = user.filter(params: params) end end q.1 > if 'load_and_authorize_resource' called instance variable load ? q.2 > if loads @user or @users how make load on @object ? i think i'm lacking sufficient knowledge understanding cancan (i'm rails newbie) , using since last 4 days, hoping question makes sense. a resource not loaded if instance variable set. makes easy override behavior through before_filter on actions - cancan https://github.com/ryanb/cancan/blob/master/lib/cancan/controller_additions.rb line 34 , 35, can in controller -- before_filter :set_instance_variable load_and_authorize_resource private def set_instance_variable @object = "blah blah blah" end load_and_authorize_resource should called after setting instance variable i.e. after 'before_filter :set_instance_variable'

c# - Changing mvc projects into mvc5 area -

i have time created few mvc websites. other day super suggested put them 1 solution - more or less - related each other. have come long way making projects work more or less on own. yesterday hit little bump put 1 project log in in order register data. have moved login code first website (front?) , works. when wanted create link (actionlink) link registration project, started doing research on moving/transforming/changing project area in mvc5. so question: has moved/transformed/changed mvc5 (or 4 or 3) project mvc5 area? there worry when doing this? there several things consider when merging project. routes , namespacing - if controllers have same names in multiple areas, need add namespace entry route entries. details here http://haacked.com/archive/2010/01/12/ambiguous-controller-names.aspx/ make sure have area registration file sets each area. add 1 area, copy it's registration file , rename appropriately script , css dependencies - make sure added root

oracle11g - DROP Materialized View -

i've problem dropping materialized view in oracle. i've got error message : "disconnected process" , error 3113. does can give me hint? thx you can go through below link better understanding of issue.. network disconnected

java - logback: DBAppender not writing to logging_event_exception -

i have following logback.xml configuration <?xml version="1.0" encoding="utf-8"?> <configuration> <appender name = "db" class="ch.qos.logback.classic.db.dbappender"> <connectionsource class="ch.qos.logback.core.db.drivermanagerconnectionsource"> <driverclass>com.microsoft.sqlserver.jdbc.sqlserverdriver</driverclass> <url>jdbc:sqlserver://servername:1433;databasename=dbname</url> <user>user</user> <password>pass</password> </connectionsource> </appender> <root> <level value="debug" /> <appender-ref ref="db" /> </root> </configuration> and expecting simple test create entry in logging_event_exception table: public static void main(string[] args) { logger logger = l

windows phone 8 - Download Original XAP from Dev Center -

Image
i have windows phone 8/8.1 app in windows phone app store. unfortunately, have lost source due system crash. now, want decompile xap file. decompilation have downloaded justdecompile telerik. fails decompile xap file store. have idea file encrypted. is there way original file created using visual studio, still available somewhere on dev center (it shows file name published app)? is there other workaround source xap? any suggestions highly appreciated. need app project back. install app on sd card. plug in sd card pc, change view property show system files. now, can apps installation folder , dll's now.

javascript - Android: get link from HTML-code (no tag/id) -

i want download ical file app. works fine, link file change every 6 months. the page/link inherits link file not change, want code of main page , find link ical file download it. i think may work best javascript, have no clue that. there no tag or id search for. this page search link: https://stundenplan.hs-furtwangen.de/splan/std?act=tt&lan=de&pu=-1&sel=pg&og=1433&pg=cnb4 the search pattern "/splan/ical" there found link file. in end need "/splan/ical?type=pg&amp;puid=6&amp;pgid=1617&amp;lan=de" stored somewhere. right use downloadmanager file, no html-code stored anywhere. hope can help. thanks. edit: here part of html source contains link (first href): <tr> <td /> <td colspan="1"><a href="/splan/ical?type=pg&amp;puid=8&amp;pgid=2505&amp;lan=de"><img style="align: middle; border: 0;" src="/splan/pictures/ical.png&qu

mongoimport - MongoDB import succeeds on one machine, fails on another -

i'm trying import kdd-cup-99 dataset (found here: http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html ) mongodb. i've done on 1 machine using following command: mongoimport --db dbname --collection colname --type csv --file kddcup.data.corrected --fieldfile kddcup99header when use findone() @ results, looks well; output follows: > db.colname.findone() { "_id" : objectid("547c33e376945996ed878f81"), "duration" : 0, "protocol_type" : "tcp", "service" : "http", "flag" : "sf", "src_bytes" : 215, "dst_bytes" : 45076, "land" : 0, "wrong_fragment" : 0, "urgent" : 0, "hot" : 0, "num_failed_logins" : 0, "logged_in" : 1, "num_compromised" : 0, "root_shell" : 0, "su_attempted" : 0, "num_root" : 0,

c# 4.0 - Writing files in windows phone 8 -

i want read , write data text file in windows phone 8 application. tried code isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication(); streamwriter wr = new streamwriter(new isolatedstoragefilestream("file.txt", filemode.openorcreate, isf)); wr.writelineasync("hello"); wr.close(); but nothing. please me out of problem. thanks. write data file: isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication(); //create new file using (streamwriter writefile = new streamwriter(new isolatedstoragefilestream("myfile.txt", filemode.create, fileaccess.write, myisolatedstorage))) { string sometextdata = "this text data saved in new text file in isolatedstorage!"; writefile.writeline(sometextdata); writefile.close(); } read data file: isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication(); isolatedstoragefilestream filestream = myisolatedstorage.o

security - How to force killing application when minimizing in Android -

right i'm developing kind of password manager & generator application , done i'm facing problem seems bit hard solve. in order yo improve security of app, added timer if user under inactivity app close. i'd close app every time user want minimize (pressing "home" button , "recent apps" button). i've tried onstop() , onpause() nothing works because every activity on app when replaced moves through mentioned states. since can't use keycode == keycode.home how that? i suggest activities keep track of state in onresume() , onpause(): can increment static application-wide variable counting how many of activities visible. when count goes zero, means none of activities visible , can cleanup. the solution proposed @don chakkappan not enough think, activity can reported active though it's no longer visible.

python 2.7 - How to make IP validation for QtGui.QInputDialog.GetText() -

i writing code in pyside has button "change ip". when button clicked dialog box appears has text box. want validation on text box accept ip address. i using code: qtgui.qinputdialog.gettext(self, "title", "enter ip: ") afair, qinputdialog.gettext not support on-the-fly validation, if willing roll own dialog, use qregexpvalidator 1.look needed regex on internets ( here , instance). see looks ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ ip4 create qregexp object, this: rx = qregexp("regular_expression_string_from_step_1") 3.create qregexpvalidator instance , pass rx object it's constructor, this: my_validator = qregexpvalidator(rx) call my_line_edit.setvalidator(my_validator) that's it, my_line_edit should refuse entry of non-valid ip adresses. if don't want go way, use python's own re moodule post-factum validation using regex s

c# - Binding grid after generating pdf and creating download -

i have page grid generates pdf files using itextsharp dll. code following: var document = new document(); bool download = true; if (download == true) { pdfwriter.getinstance(document, response.outputstream); bindgrid(); } string filename = "pdf" + datetime.now.ticks + ".pdf"; try { document.open(); // adding contents pdf file.... } catch (exception ex) { lblmessage.text = ex.tostring(); } { document.close();

Blanks in Crystal Report Using Sub-Reports -

Image
i have tried related topics on stack overflow find relating problem. hope there clever can assist. layout of report: now can see group header , details & b contain subreports. details b suppressed , hide blank sections. group header #1 in section ticked suppress blank , keep together. went each individual sub report , set details sections suppress blank , went main report right clicking on each subreport , set in uncommon tab unticked keep objects under subreport tab checked option suppress blank sub report. but can see there still blanks printing info suppressed condition have set.... anybody have ideas?

git - Read from remote host: The connection was aborted -

i can't push commit remote when large or many files. i can pull : p:\wamp\www>git pull myuser@myserver.ovh.net's password: up-to-date. but can't push : p:\wamp\www>git push myuser@myserver.ovh.net's password: counting objects: 170, done. delta compression using 4 threads. compressing objects: 100% (31/31), done. writing objects: 100% (32/32), 767.20 kib | 0 bytes/s, done. total 32 (delta 24), reused 0 (delta 0) read remote host myserver.ovh.net: connection aborted fatal: remote end hung unexpectedly fatal: remote end hung unexpectedly i've searched on google , here the solution of increasing git buffer doesn't work . for info, p:\wamp\www>git remote -v origin ssh://myuser@myserver.ovh.net/home/myuser/repo (fetch) origin ssh://myuser@myserver.ovh.net/home/myuser/repo (push) i've rebooted vps, same result. after filmor comment, i've tried git push origin master everything date . edit : clarify, want push branch, git pus

java - Null Pointer Exception in setter of entity in hibernate -

i trying map one-to-one relation between user , proteindata entity getting null pointer exception in setter in user entity. my main service code program.java public class program { public static void main(string a[]){ session session=hibernateutility.getsessionfactory().opensession(); session.begintransaction(); user user=new user(); user.addhistory(new userhistory(new date(),"set name akku")); user.setname("akku"); user.getproteindata().settotal(234); user.addhistory(new userhistory(new date(),"set goal 234")); session.save(user); session.gettransaction().commit(); session.begintransaction(); user loadedeuser=(user)session.get(user.class,1); system.out.println(loadedeuser.getname()); system.out.println(loadedeuser.getproteindata().getgoal()); for(userhistory history:loadedeuser.gethistory()){ //system.out.p

python - openCV Error in cvtColor function: Assertion failed (scn == 3 || scn == 4) -

i want load video file, convert grayscale , display it. here code: import numpy np import cv2 cap = cv2.videocapture('cars.mp4') while(cap.isopened()): # capture frame-by-frame ret, frame = cap.read() #print frame.shape # our operations on frame come here gray = cv2.cvtcolor(frame, cv2.color_bgr2gray) # display resulting frame cv2.imshow('frame',gray) if cv2.waitkey(1) & 0xff == ord('q'): break # when done, release capture cap.release() cv2.destroyallwindows() the video plays in grayscale till end. freezes , window becomes not responding , following error in terminal: opencv error: assertion failed (scn == 3 || scn == 4) in cvtcolor, file /home/clive/downloads/opencv/opencv-2.4.9/modules/imgproc/src/color.cpp, line 3737 traceback (most recent call last): file "cap.py", line 13, in <module> gray = cv2.cvtcolor(frame, cv2.color_bgr2gray) cv2.error: /home/clive/downloads/opencv/op