Posts

Showing posts from April, 2012

faceted search - Solr: Facet one field with two outputs -

i'm using solr indexing products , organising them several categories. each document has taxon_names multi value field, categories stored human readable strings product. now want fetch categories solr , display them clickable links user, without hitting database again . @ index time, permalinks every category mysql database, stored multi value field taxon_permalinks . generating links products, need human readable format of category , permalink (otherwise have such ugly urls in browser, when using plain human readable name of category, e.g. %20 space). when facet search http://localhost:8982/solr/default/select?q=*%3a*&rows=0&wt=xml&facet=true&facet.field=taxon_names , list of human readable taxons counts. based on list, want create links, don't have hit database again. so, possible retrieve matching permalinks solr different categories? example, xml this: <response> <lst name="responseheader"> <int name="status"

`initialize': No such file or directory - getaddrinfo (Errno::ENOENT) when Rails new app -

i try create rails app in rails 4.00 ruby ruby-2.0.0-p247. while bundle install processes, shows error: initialize: no such file or directory . below output of error run bundle install /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `initialize': no such file or directory - getaddrinfo (errno::enoent) /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `open' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `block in connect' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in `timeout' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in `connect' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1449:in `begin_transport' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request' /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1376:in `request' /

How do I send a gmail email in vb.net? -

i want send email, gives me error. i have code: sub sendmail(byval title string, byval content string) dim smtpserver new smtpclient("smtp.gmail.com", 25) smtpserver.credentials = new net.networkcredential("name@gmail.com", "password") dim mail new mailmessage("name@gmail.com", "name@gmail.com", title, content) smtpserver.send(mail) end sub i have try catch tries call method, doesnt work catch runs , thes exception: system.net.mail.smtpexception: smtp server requires secure connection or client not authenticated. server response was: 5.7.0 must issue starttls command first. b6sm3176487lae.0 - gsmtp why error? , how fix it? gmail uses smtp on ssl on port 465. try doing: dim smtpserver new smtpclient("smtp.gmail.com", 465) ... smtpserver.enablessl = true ...

ruby on rails - RSpec test fails when checking if user.should be_valid -

i'm new testing, , can't figure out why fails: i have test require 'spec_helper' require 'cancan/matchers' describe user subject(:user) { user.create!(email: 'test@test.com', password: '12345678', password_confirmation: '12345678', goal_id: '1', experience_level_id: '1', gender: 'female') } "should valid name, goal, password, password_confirmation, experience_level, , gender" user.should be_valid end i think should pass. can create user through site front end, i'm getting following fail message: 1) user should valid name, goal, password, password_confirmation, experience_level, , gender failure/error: subject(:user) { user.create!(email: 'test@test.com', password: '12345678', password_confirmation: '12345678', goal_id: '1', experience_level_id: '1', gender: 'female') } runtimeerror: called id nil, mistakenly 4 -- if wan

ubuntu - Jetty and tomcat are responding on the browser but giving a connection refused error via cURL -

i'm getting weird problem on local solr-jetty installation on ubuntu machine. did "sudo apt-get install solr-jetty" (which installs jetty dependency). when open http://127.0.0.1:8080 on browser, "welcome jetty 6 on debian" page. when try to: curl http://127.0.0.1:8080 i html informing me of (111) connection refused response. have idea what's happening? thanks. edit: apparently problem not jetty. removed jetty , tried tomcat6 , same problem still happening. maybe network config on particular machine? see if you've got environment variable "http_proxy" set in shell: env | grep -i proxy if that's case, try disabling looking being set in /etc/profile.d/ or /etc/env.d or $home/.bashrc . ymmv because have no idea ubuntu puts stuff. if need proxy other stuff, can add exception in https://serverfault.com/questions/42426/proxy-exceptions-when-using-http-proxy-env-var : export no_proxy=localhost,127.0.0.0/8 #

javascript - bootstrap component's navigation sidebar + animated section indicator -

Image
i've been trying weeks build navigation sidebar these images: i'm using twitter bootstrap, however, though getbootstrap.com/components has looking navigation sidebar, there no such component in library , pain build one. therefore, resorted using jquery in attempt build 1 tommy hilfiger's global site. tommy hilfiger's global site however, i'm new javascript , css... weakpoints... if minified :( , i'm stuck @ trying make arrow marker , have move along (animating) , pointing current section. managed animate page scrolling though, , wip far here: wip - twitter bootstrap navigation sidebar is there open source components (or preferably bootstrap ones) achieve section indicator animation? i'm confused scripts getting messier, open source component highly desireble, however, input on how achieve (with script example please) appreciated.. thank in advance! check out scrollspy, component exist on bootstrap itself: bootstrap scrollspy

oracle - Extract text between words -

i trying extract numbers between 2 words distincts, " substr " don't work combined " instr ". @ least i'm not getting! example: codtax tax_description ----------------------- 1225 ncm 85444900 ipi 0% icms 18% cst 060 iva 41,00% iva ext 51,32% the extract number between "ipi " , "% icms" 0 or between "iva " , "% iva" 41.00 . create table tax ( codtax number, tax_description varchar2(200 byte) ); insert tax (codtax, tax_description) values (1505, 'ncm 29051220 ipi 0% icms 18% cst 000 iva 0% iva ext 0%'); insert tax (codtax, tax_description) values (1258, 'ncm 85444900 ipi 0% icms 18% cst 060 iva 41,00% iva ext 51,32%'); insert tax (codtax, tax_description) values (2051, 'ncm 85362000 ipi 10% icms 18% cst 060 iva 43,00% iva ext 53,46%'); the result must be: codtax tax_description ipi iva ------

java - Need to display my data from database on next tab after ajax post -

hello new ajax , jquery/jquery(ui), have application has 4 tabs (1,2,3,4). the first tab enabled , last 3 tabs disabled initially. when user clicks on next button in first tab goes second tab. when user clicks button in second tab should go third tab review or display details of information collected in database, user clicks on button in third tab goes tab 4. the problem: now clicking on button in 2nd tab, ajax post takes form data tab 1 , tab 2 liferay portlet controller class in collects data , insert database not return data function. the issue when click on next button in second tab goes third tab shows table header information , not table row data (i.e empty). way shows data when physically click on refresh page browser in goes first tab have go click on tab 1 , tab 2 again see data in table row on tab 3 inserted database. here code snippets. can please in how resolve issue? suitable way of implementing solution? <script type="text/javascript"> $(

c# - Good way to retrieve images stored as bytes array in the db using ASP.NET MVC4? -

i'm programming asp.net mvc4 application stores uploaded images byte[] in database (with entity framework) , displays them. display images i'm using code in view: <img src="data:image;base64,@system.convert.tobase64string(item.imagebyte)" alt=""/> but each time refresh page see browser not cache image , renders again causing unecessary bandwith usage. maybe there's more bandwith friendlier way display image? maybe idea store uploaded image 'byte[]' stupid in first place (my application simple web page stores articles psychology :d admin panel achieve this) , should store images in folder? thanks in homecontroller add function this: [httpget] public fileresult getimage(string id) { byte[] filecontents = ...; // load database or file system string contenttype = "image/jpeg"; return file(filecontents, contenttype); } register route handler in global.asax.cs : routes.maproute( "getimag

java - ArrayList IndexOutOfBoundsException -

i'm trying create program draws shape specified number of sides keep getting errors , i'm not sure issue is. public double tempx = 0; public double tempy = 0; public int angle = 0; public double length = 0; public int nodes = 0; public int height = 170; //public double xcoordinate = 0; //public double ycoordinate = 0; //unused variables /** * creates new form shape */ public void drawshape(int nodes,int height){ double apothem=0; double circumradius=0; double x = 180/nodes; arraylist<double> xcoordinate = new arraylist(nodes); arraylist<double> ycoordinate = new arraylist(nodes); //angle = (180*(nodes-2))/2*nodes; //angle half interior angle of shape(currently unused) angle = 360/nodes; if(nodes%2==1){ length = (2*height*math.tan(math.toradians((x))))/(1+math.cos(math.toradians((x)))); apothem = length/(2*math.ta

How do I open cakephp's index.php through MAMP? -

i'm new web designing , installed mamp , cakephp. (configured mamp per many tutorials online). i'm learning cake through blog tutorial. want know how access cake's index.php file on web browser. cake bake console runs fine through command line. but, of cakephp's files stored in /users/username/sites/cake (tutorial asked me place file there) while mamp's document root /applications/mamp/htdocs. now, i'm not sure how proceed blog tutorial , access cakephp files through web browser, being hosted localhost on mamp. i'm confused , use help. move files htdocs . the cake core should go htdocs\lib\cake . app files should in htdocs\app . so htdocs should this: htdocs\ app\ lib\ .htaccess index.php more info: http://book.cakephp.org/2.0/en/getting-started/cakephp-folder-structure.html

c# - Get Local Folders from App WinRT -

i'm having issue trying save file folder of winrt app i'm working at. more specific : can't manage retrieve folder. need save files , afterwards retrieve them same folder, let's myfolder @ same level in app assets folder. how can achieve such thing? so far tried await windows.applicationmodel.package.current.installedlocation.getfolderasync("myfolder") and await applicationdata.current.localfolder.getfolderasync("myfolder"); and both seem tell me such folder doesn't exist. now, can't seem figure out if i'm on right track or it's foolish i've done , causes exception. can't post whole code, because it's call larger method other calls, , on. also, i'd know (if of these methods correct), if app gets update, content affected in way (better said, lost). thank you. windows.applicationmodel.package.current.installedlocation give 'file system' defined application package, you'd see comm

json - Convert Python String to Dictionary -

i have string: a = "{user_id:34dd833,category:secondary,items:camera,type:sg_ser}" i need convert python dictionary, that: a = {"user_id":"34dd833", "category": "secondary", "items": "camera", "type": "sg_ser"} on top of that, there 2 more issues: 1: "items" key supposed have multiple values, like: a = {"user_id":34dd833, "category": "secondary", "items": "camera,vcr,dvd", "type": "sg_ser"} which apparently comes form of string as: a = "{user_id:34dd833,category:secondary,items:camera,vcr,dvd,type:sg_ser}" so, generalizing based on comma separation becomes useless. 2: order of string can random well. so, string can well: a = "{category:secondary,type:sg_ser,user_id:34dd833,items:camera,vcr,dvd}" which makes process of assuming thins order false one. what in such situati

charts - Draw jOrgChart from JSON -

is there option org chart json ? any other option make charts json (for html ajax). ty much yeah possible. here used taffydb plugin querying json. you can full code github

android - csv FileNotFoundException: ENOENT -

i trying access csv file assets app , filenotfoundexception. same when try access elsewhere. idea should doing here? log messages work fine until then. error on logcat follows. tag text system.err java.io.filenotfoundexception c:\users.....\assets\cms.csv: open failed enoent (no such file or directory) for code: br = new bufferedreader(new filereader ("c:\\users\\srihari\\workspace\\cmshealthcare\\assets\\cms.csv")); any appreciated! thanks in advance! dont point file system on computer...instead use getassets method target filesytem in raw folder gets bundled apk (the binary of app) br = new bufferedreader(new inputstreamreader(getassets().open("cms.csv")));

default_icon vs. icon creating Chrome Extension -

i have discovered weird scenario playing manifest file attempitng build chrome extension. using chrome version 28.0.1500.95 mac, , confused on how display extension icon on toolbar. have found multiple tutorials explain define "default_icon" : "icon_name.png" within "browser_action" associative array so: "browser_action" : { "default_icon" : "icon_name.png" } however, according documentation preferred use array: icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" } the documentation includes details original way (my first example) still supported: 19 x 19 icon reengineered view on particular display pixel density- can cause image lossy. my question not images display when have complete setup, pastebin has manifest file extension manager not show 48 px image. have answered question of mine writing out- defaul

javascript - Filter Listview Not Showing Up Properly -

Image
i made filtered listview, shows 2 search boxes: my code: html <div data-role="page" id="searchevents"> <div data-role="header"> <h1>search</h1> </div> <div data-role="content"> <ul id='searchlist' data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="search club or event name..."></ul> </div> </div> js $( document ).on( "pageinit", "#searchevents", function() { $( "#searchlist" ).on( "listviewbeforefilter", function ( e, data ) { var $ul = $( ), $input = $( data.input ), value = $input.val(), html = ""; $ul.html( "" ); if ( value && value.length > 2 ) { $ul.html( "<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></di

java - json parsing function returns weird package name -

i have made json parsing class returns string. when set text of textview string, print 'com.test.app.jsonparser@41eddbf8' what's going wrong? heres parsing class import android.os.asynctask; import android.util.log; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.params.basichttpparams; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; /** * created vaibhav on 8/9/13. */ public class jsonparser extends asynctask<string, void, string>{ protected string doinbackground(string... url) { defaulthttpclient httpclient = new defaulthttpclient(new basichttpparams()); httpget httpget = new httpget(url[0]); //httppost.setheader("content-type", "application/json"); inputstream inputstream = null; string result;

ms office - How to add macros to the menubar in powepoint 2011(powerpoint for mac)? -

i have created macros in powerpoint 2011(powepoint mac). want add macro menubar. able in word 2011 in powerpoint when go view >toolbars >customize toolbars , menus > toolbars , menus(tab), in categories not able find macros. please let me know solutions or input helps add macros menubar. thank !!

javascript - Angular JS directive not updating scope variable -

i'm trying build simple directive in angularjs accepts config options via attributes, if attributes not set, want set default values attributes. here's how describe scope: scope : { classes: '@', progress: '@' } these attribs displayed in view in following way: <div class="{{classes}}"> <div style="width: {{progress}}%;" class="bar"></div> </div> in link function, try set default values in way: link: function(scope, el, attrs) { console.log( scope.classes, scope.progress ); if (typeof scope.classes === 'undefined') scope.classes = 'progress progress-warning'; if (typeof scope.progress === 'undefined') scope.progress = 99; console.log( scope.classes, scope.progress ); } here's console output: undefined undefined progress progress-warnin

javascript - Kendo, How do you bind MVVM text: fields to a remote DataSource? -

i have example of working local values defined in viewmodel (observable) class constructor, not seem work when have remote datasource. http://jsfiddle.net/hbunp/7/ how example similar 1 below working remote datasources, possible? <div id='root'> <label>remote name: </label> <span data-bind="text: firstname"><!--firstname--></span>, <span data-bind="text: lastname"><!--lastname--></span> <div> <label>remote name: <input data-bind="value: firstname" />, <input data-bind="value: lastname" /> </label> </div> </div> <br/> <br/> <div id='local-root'> <label>local name: </label> <span data-bind="text: firstname"></span>, <span data-bind="text: lastname"></span> <div>

javascript - $.post not working in ie. Alternative way help please? -

i used $.post send , receive response in web page. not working in internet explorer. used other way of ajax. have create xmlhttprequest object. my code is var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("post","demo_post2.asp",true); xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded"); xmlhttp.send("fname=henry&lname=ford"); this works fine browser except ie-10. write code below support ie-10. if (window.xmlhttprequest) {

math - C++ - fmod return the wrong answer -

first off, i'm doing project school , not allowed use external libraries , hence cannot use gmp. problem is, have function requires "tough" calculations. ie, m^e mod n here's code #include <iostream> #include <math.h> using namespace std; int main() { int e = 17, n = 3233, m = 65; long double p, mod; p = pow(m, e); // gives 6.59974e+30 correct mod = fmodl(p, n); cout<<mod; // gives 887, when correct answer 2790 return 0; } as can see fmod (fmodl) function not return correct value there workaround ? again, without using external libraries. you can write own modulo power function. int modpow(int a,int b,int mod) { int product,pseq; product=1; pseq=a%mod; while(b>0) { if(b&1) product=(product*pseq)%mod; pseq=(pseq*pseq)%mod; b>>=1 } return product; } refer http://en.wikipedia.org/wiki/modular_exponentiation explanation

403 User Rate Limit Exceeded and 401 Invalid Credentials - Google Analytics API v3 -

we able data google analytics using oauth2.0, getting 403 user rate limit exceeded , 401 invalid credentials. on server start getting, severe: unable refresh token com.google.api.client.auth.oauth2.tokenresponseexception: 403 user rate limit exceeded and subsequent requests giving, com.google.api.client.googleapis.json.googlejsonresponseexception: 401 unauthorized { "code" : 401, "errors" : [ { "domain" : "global", "location" : "authorization", "locationtype" : "header", "message" : "invalid credentials", "reason" : "autherror" } ], "message" : "invalid credentials" } i have tested access token following url : https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=xxxxxxxx i getting valid access token message, still getting invalid credentials. have tried oauth2 playground, here getting same mess

iphone - UITableView custom cell can't scroll fluent,as database block my main thread -

i used multi column tableview !for 1 screen have 16 cells,and if have 3000 data ,and got thumbnail image database( use open source -fmdb),and when load table,i open 1 thread download thumbnail, , save database. when cell visible,i got thumbnail db,if had been downloaded. found got data database slow,about 0.15~1.3 seconds 1 cell, , have 16 cell 1 screen. block main thread? any suggestion me solve problem? thanks in advance. this code thumbnail~ -(nsdata *)queryvideosmallthumbnaildata:(nsstring *)thesourceurl { if(thesourceurl == nil) return nil; nsstring *query = @"select small_thumbnail_data fields source_url"; query = [query stringbyappendingstring:@"=\""]; query = [query stringbyappendingstring:thesourceurl]; query = [query stringbyappendingstring:@"\""]; nsdata * data = nil; fmresultset *rs = [database executequery:query]; while ([rs next]) { data = [rs dataforco

python - pyinstaller setup failed with "setup.py is not yet supposed to work. Please Use PyInstaller without installation." -

i trying "pip install pyinstaller" on mountain lion. failed with setup.py not yet supposed work. please use pyinstaller without installation. there ticket ( http://www.pyinstaller.org/ticket/629 ) not helpful. i using pythonepd 7.1. as says "it not yet supposed work" - if read documents find unzip/unpack local directory , run there. you not supposed run setup.py in pyinstaller @ - see here how set pyinstaller. once installed and on path run typing pyinstaller your_main.py in project directory. may have generate specification file , edit things work correctly - see documentation!

c# - Uploading image to server and reading the response -

i have posted image file server having php file. i used following code : void photochoosertask_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { byte[] sbytedata = readtoend(e.chosenphoto); string s = sbytedata.tostring(); webclient wc = new webclient(); uri u = new uri("http://example.com/file.php"); wc.openwritecompleted+=new openwritecompletedeventhandler(wc_openwritecompleted); wc.openwriteasync(u, "post", sbytedata); } } public static void wc_openwritecompleted(object sender, openwritecompletedeventargs e) { if (e.error == null) { object[] objarr = e.userstate object[]; byte[] filecontent = e.userstate byte[]; stream outputstream = e.result; outputstream.write(filecontent, 0, filecontent.length); outputstream.flush(); outputstream.close(); string s = e.result.tostring(); } } but how read res

javascript - window.pageYOffset or just pageYOffset? / X + IEnumber+ pageYOffset / X support? -

1) i've noticed (at least in chrome) there no difference in output of these two: pageyoffset; window.pageyoffset; they both access same global return same - difference between these calls , better use? my current suspicion: suspect look-for-variables implementation, idea window.pageyoffset direct access window object pageyoffset property whereas runing pageyoffset "slowly" every scope deep top , finaly finds in (super)global scope. think? did make tests? 2) ienumber+ supports window.pageyoffset / or pageyoffset ? 2) answer: mdn says ie<9 doesnt support those, answer 2) problably ie9+ (no surprise)         source: @blender & https://developer.mozilla.org/en-us/docs/web/api/window.scrolly using window. prefix faster because, mentioned, there no lookup. won't mess if define local variable called 'pageyoffset' because still @ window.pageyoffset. i because it's more explicit , there less confusion. edit: difference lookup

internet explorer - Webbrowser Control - displaying text using "write" -

i'm using iwebbrowser2 interface render page html string created @ runtime. have written method (let's call displayhtmlstring) takes html string , renders shown in this example . method calls navigate2 "about:blank" first, ensure document present, , calls close after calling write. the first time call displayhtmlstring, page rendered correctly, i.e. browser displays html according string pass. problem subsequent calls not work correctly, render blank page instead. causing this? i have found out when blank page shown, result of navigating about:blank. determined navigating local file instead, shown (whereas html string should shown instead, due subsequent write/close). call navigate2 works, while calls write , close don't. i considered ie-internal security checks possible cause (cross-domain checking?), gut feeling isn't what's happening here. it seems more me kind of synchronization problem, along lines of "ie hasn't finished rendering

android - Phonegap and making use of Plugins (specifically the Facebook Plugin) -

Image
i'm @ wits ends phonegap , plugins!! i have created phonegap app , works , runs on android. wish use facebook js sdk. have been using plugin found here . keep running 100 different errors. the code in connectplugin.java saying plugins has been deprecated. i'm using cordova 2.3.0 , in cordova 2.3.0.jar plugin.java class exists seen in picture below: i'm not sure on earth plugin work? have tried , have searched net hours no working solution. need facebook plugin work. please appreciated!! should ever have plugin problems ie there complainant plugin class above, @ least facebook problem has been solved here

android - How can I pass an audio file as input instead of recorded voice to Google search voice? -

the following code can recognise voice using google voice search when speak microphone. how can pass audio file input instead of microphone google search voice? private void startvoicerecognitionactivity() { intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model, recognizerintent.language_model_free_form); intent.putextra(recognizerintent.extra_prompt, "speech recognition demo"); startactivityforresult(intent, voice_recognition_request_code); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == voice_recognition_request_code && resultcode == result_ok) { // fill list view strings recognizer thought have heard arraylist<string> matches = data.getstringarraylistextra( recognizerintent.extra_results); mlist.setadapter(new arrayadapter<string>(this, an

Create a collection of sub collection from a given Collection (Group By) in Java -

i have array list of dates spanning several years i.e. arraylist<date> datelist have object represents grid of months each year i.e. public class datetilegrid { private int mcurrentyear; private arraylist<date> mdatetiles; ... // getters , setters } i want create arraylist<datetilegrid> contain relevant dates each year. i know how loop (nasty nested loops) hope there cleaner way achieve that. probably need until java 8 closures comes hashmap<integer, datetilegrid> datagridmap = new hashmap<>(); (date date: datelist) { int year = date.getyear(); //deprecated.. use better datetilegrid datagrid = datagridmap.get(year); if(datagrid == null){ datagrid = new datetilegrid(); datagrid.setcurrentyear(year); datagrid.setdatetiles(new arraylist<date>()); datagridmap.put(year, datagrid); } datagrid.getdatetiles().add(date); } //here result arraylist<datetilegrid> re

trigger.io - How to retrieve contents from an asp page using Forge API? -

i new trigger.io , wondering if can provide complete example content external asp page. basically, trying achieve similar following code forge api. <!doctype html> <html> <head> <script> function showhint(str) { var xmlhttp; if (str.length==0) { document.getelementbyid("txthint").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("txthint").innerhtml=xmlht

php - How to flush gzipped part of html page -

i'm trying have page output it's < head > + body stuff, , send browser. then make long mysql queries , output rest of page. this works long don't gzip content. example: a simplified example of code use works: <?php ini_set('output_buffering', 'on'); echo "head..wait 3 secs</br>"; ob_flush(); flush(); sleep(3); echo 'tail'; ?> see live here no gzip or i'm trying working: <?php ini_set('output_buffering', 'on'); ini_set('zlib.output_compression', 'on'); echo "head...wait 3 secs</br>"; ob_flush(); flush(); sleep(3); echo 'bar'; ?> which doesn't work see: here i need work in application not on pages (some don't need gzip or libraries handle them selves, caldav library example), prefer php solution rather enabling deflate application wide .htaccess what can make flushing gzipped content work? i

android - How can I show mActionBar when it's invisible, and hide it when it's visible? -

my current code shows mactionbar. how can switch hide or show , force? @override public boolean onkeydown(int keycode, keyevent event) { if(keycode == keyevent.keycode_menu){ mactionbar.show(); }else if(keycode == keyevent.keycode_back){ webview mywebview = (webview)findviewbyid(r.id.webview1); mywebview.goback(); } return true; } as actionbar has isshowing() method, can use check if visible or not, , decide whether needs shown or hidden. code should work, haven't tested it. private void toggleactionbar() { if (mactionbar.isshowing()) { mactionbar.hide(); } else { mactionbar.show(); } } then can replace mactionbar.show() in code snippet instead call toggleactionbar() .

node.js - ruining EasyRTC server using iisnode -

Image
easyrtc 1 of best available opensource webrtc solutions runs in node.js! have manged run on node.js on system application in asp.net i've been trying run using under iis using iisnode! reason haven't been able make work! running application in node.js use node server.js start server in iis when set default page server.js start application wond work! result using nodejs: nodejs result: (working properly) iisnode result: looks it's not running ! this error due lack required module easyrtc. type in node command prompt "npm install" install dependency module. , after try run server. hope work you.

c++ - It seems at a glance that a constructor return an object -

there many ways initialize object, 1 of calling constructor of centain user-defined type. here examples. hello my_hello = hello(3); hello my_hello(3); as know, constructor doesn't return anything. however, above, seems return initialized object. furthermore, assignment operator makes more suspicious because means copys right-hand object left-hand object. am guessing wrong? please explain it? the declaration hello my_hello = hello(3); creates 2 objects. first temporary object hello(3) , , temporary object copied through copy-constructor my_hello followed destruction of temporary object. however, further muddle water, copying , destruction of temporary object may not happen due copy elision , common compiler optimization.

java - Why is PostConstruct not called? -

i working on simple java ee application. i have class this: import javax.annotation.postconstruct; import javax.ejb.stateless; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory; import javax.persistence.persistence; @stateless public class blogentrydao { entitymanager em; @postconstruct public void initialize(){ entitymanagerfactory emf = persistence.createentitymanagerfactory("persistence"); em = emf.createentitymanager(); } public void addnewentry(){ blogentry blogentry = new blogentry(); blogentry.settitle("test"); blogentry.setcontent("asdfasfas"); em.persist(blogentry); } } so managed bean calls method. until here no problems. since initialize method not called, getting npe in em.persist . why initialize method not being called? running on glassfish server. regards. the java ee bean annotations such @postconstruct

c# - Is there anyway to specify the possible types for a generic class? -

i'm trying write code xna have own drawing modules can use cache/draw static vertices/indices. here's class , line in question giving me trouble line 51. _vertexbuffer.setdata(_vertices.toarray()); it has error: the type 't' must non-nullable value type in order use parameter 't' it doesn't seem setdata expects array of vertices matches vertexdeclaration used in vertexbuffers constructor, whilst definition of list/class says can type. is there anyway specify <t> vertices? they called generic type constraints . whatever vertexbuffer type is, has on method: void setdata<t>(...) t : struct this causing error. in fact, msdn says method signature: public void setdata<t> ( t[] data ) t : valuetype which same. so, fix this, you'll have pass in array of items value types, not reference types. is, instantiation of drawmodule<t> must drawmodule<valuetypehere> .

java - Grails password encrypt with rsa -

i want create module called user. module consists of name, username, phoneno, , password. want encrypt , decreypt password using rsa algorythm. this rsa.java import java.math.biginteger; import java.security.securerandom; /** * simple rsa public key encryption algorithm implementation. */ public class rsa { private biginteger n, d, e; private int bitlen = 1024; /** create instance can encrypt using elses public key. */ public rsa(biginteger newn, biginteger newe) { n = newn; e = newe; } /** create instance can both encrypt , decrypt. */ public rsa(int bits) { bitlen = bits; securerandom r = new securerandom(); biginteger p = new biginteger(bitlen / 2, 100, r); biginteger q = new biginteger(bitlen / 2, 100, r); n = p.multiply(q); biginteger m = (p.subtract(biginteger.one)).multiply(q.subtract(biginteger.one)); e = new biginteger("3"); while (m.gcd(e).intvalue() > 1) { e = e.add(new biginteger("