Posts

Showing posts from April, 2014

bash - How to echo random amounts of dots mixed with spaces? -

i bash/terminal command make echo ... . . . . . . .. ...... .. . . . in other words random amounts of dots perhaps 100 dots max, mixed spaces. how can done via bash script ? here 1 liner: max=$((random%100)); ((i=0;i<max;i++)); ((random%2)) && a="$a." || a="$a "; done; echo "$a" or in more readable format: max=$((random%100)) ((i=0;i<max;i++)) ((random%2)) && a="$a." || a="$a " done echo "$a"

maven - Setting Up Nutch 2.2 -

i trying set-up nutch 2.2. when run ant runtime command build project fails build with: server access error: connection refused.......... which followed maven repositories of files cannot download. there proxy server set-up not allow me download things , fear problem here. is there other way of setting up? you have configure proxy ant, in console, before ant runtime , can configure ant options like: export ant_opts='-dhttp.proxyhost=proxy -dhttp.proxyport=8080 -dhttp.proxyuser=user -dhttp.proxypassword=password -dhttps.proxyhost=proxy -dhttps.proxyport=8080' if not enough, maybe need configure ~/.m2/settings.xml adding (something like): <proxies> <proxy> <id>proxyid</id> <active>true</active> <protocol>http</protocol> <username>user</username> <password>password</password> <host>proxy</host> <port>808...

java - Itext:How to deal with itext 5.4.3? -

i want upgarde code itext 5.4.3. written in earlir version of itext i.e 2.1.7. i have problem while declaring table,paragraph , stuffs. earlier code this:: table tab = new table(); tab.setwidth(100); tab.addcell(new paragraph("sr. no.")); tab.addcell(new paragraph("candidate name",new font(font.helvetica, 14, font.bold))); tab.addcell(new paragraph("candidate code",new font(font.helvetica, 14, font.bold))); tab.addcell(new paragraph("login id",new font(font.helvetica, 14, font.bold))); tab.addcell(new paragraph("password",new font(font.helvetica, 14, font.bold))); so please let me know solution or link tutorials based on use of itext 5.4.3 version. check itext tutorial . seems quite complete looking for.

arrays - Use of memory in c++ -

i'm not sure how pose question, here goes: when programming on atmel mcu's in c++ tend mix 'program'-variables , 'user'-variables in same datamemory. in time hassle because want make few presets can loaded or saved. , not want 'program'-variables saved because program generate correct values based on 'user'-values. common practice split in memoryplaces? eg. timercounter in pgm-memory, thresholdbyuser in data-memory? in program i've made several different functions have own set of uservariables. eg: settings has 5 uservariables, generator has 6 uservariables etc... make 1 big array , make #define settingsgeneratorspeed 1, #define settingsbacklight 2 places, call them such: array[generatorspeed], array[settingsbacklight] or still split , collect them using struct orso? working on atmelstudio 4.0 atmega644 on stk500. thanks can give! assuming using at(x)mega, when referring atmel mcu's: iirc depends compiler suite us...

javascript - ul in li , tree display with jade -

i have object of object of object ... have tree ! i use jade code display tree : mixin file_list(files) ul each file, in files li #{file.id} if file.children.length > 0 mixin file_list(file.children) but result is: <ul> <li></li> <ul> <li></li> </ul> </ul> i need : <ul> <li> <ul> <li></li> </ul> </li> </ul> mixin file_list(files) ul each file, in files li #{file.id} if file.children.length > 0 mixin file_list(file.children)

Update linked fields in Word document from Excel VBA -

i trying automatically update information (such names, dates , numbers) across 3 different word documents putting data spreadsheet , linking respective cells word. spreadsheet has macros in auto-update parts of spreadsheet internally. everything working fine, except updating links in word documents. when trying update link in word right-clicking on , selecting "update link" option brings macro warning dialog spreadsheet, asking whether want activate macros or not. doesn't once during 20s or update process takes (which seems unusually long me). updating link works, if you're willing click "activate macros" button of few dozen times. i tried automate updating fields in document word vba, has same problem, brings macros dialog half minute. here's code that: sub updatefields() activedocument.fields.update end sub i tried update word documents directly spreadsheet, not work either, because when excel tries open word document via vba program st...

sql server - sql table row - column conversion -

Image
i have following table: how convert above table below structure? tried using pivot table couldn't work. you need have sql pivot . check this fiddle and code: select * ( select prodname, pcode, biiledamt product ) p pivot ( sum (biiledamt) prodname in ([prod1],[prod2],[prod3],[prod4]) ) pvt if not know beforehand columns can check fiddle dynamically generates columns use. the code is: declare @cols varchar(max), @query varchar(max) set @cols = stuff((select distinct ',[' + prodname +']' product c xml path(''), type ).value('.', 'varchar(max)') ,1,1,'') set @query = ' select * ( select prodname, pcode, biiledamt product ) p pivot ( sum (biiledamt) prodname in (...

c# - How do I pass a property expression back to the controller? -

i have view displays table of data want able sort specifying property on row type. my model (so far) is: class model { list<datatype> data; expression<func<datatype, object>> sortproperty; } i've tried creating in view passed controller follows: <a href='<%= url.action("index", "approvals", new indexmodel() { page = model.page, sortproperty = ((approvalmodel m) => m.id)}) %>'>id</a> which renders as: <a href='/partslegislation/approvals.aspx/approvals?sortproperty=m%20%3d%3e%20convert(m.id)'>id</a> so sort of looks it'll work (all-be-it convert expression in there), in controller sortproperty null . tl;dr: how can pass expression pointing property view controller? edit: controller action below: [httpget] public actionresult index(model viewmodel) { .... viewmodel.approvals = partsdc.repository<approval>() .wher...

actionscript 3 - january 31 2012 UTC time jump -

i'm working on flash project uses xml-data database through php generate graphs. draw on right spot want convert dates numbers , thought date.utc(yyyy,mm,dd) answer. reason doesn't convert linearly. as3-code: private function valuedispatcher(e:event):void { debugfield.appendtext("succes= "+e.target.data.succes); if (e.target.data.succes) { var myxml:xml = new xml(e.target.data.xml); var mylist:xmllist = new xmllist(myxml.children()); debugfield.appendtext("\nxml[0]= " + mylist[0]); debugfield.appendtext("\nxml[0].time= "+mylist[0].time); (var i:int = 0; < mylist.length(); i++) { var splitter:array = string(mylist[i].time).split("-"); var seconds:number = date.utc(int(splitter[0]),int(splitter[1]),int(splitter[2]),1,0,0,0); var ar:array = [mylist[i].time, seconds, mylist[i].verbruik, mylist[i].corr]; ...

php - error loop with while and foreach -

i should display table under september 2013 - 14/09/2013 | 14:30 | football | league | paris - berlin - 14/09/2013 | 19:30 | volley | cup | paris - barcelona - 25/09/2013 | 12:00 | football | amical | paris - bordeaux october 2013 - 5/10/2013 | 15: 00 | cup | paris - londres this code $datequery = mysql_query("select matches.id, date_debut, date_fin, matches.score, sports.title sport, clubs1.title recevant, clubs2.title visiteur, competitions.title competition, matches.description, sexes.title sexe matches inner join sexes on sexes.id = matches.sexe_id inner join sports on sports.id = matches.sport_id inner join clubs clubs1 on clubs1.id = matches.recevant_id inner join clubs clubs2 on clubs2.id = matches.visiteur_id inner join competitions on competitions.id = matches.competition_id current_date()<=date_debut order date_debut asc") or die(mysql_error()); while($row=mysql_fetch_assoc($datequery)){ print '<b>...

email - PHP: Get input and send as attachment in phpmailer -

i using phpmailer https://github.com/synchro/phpmailer send images attachments in emails. but it's not working when this: $photo = $_get['photo_send']; $photo = realpath($photo); var_dump($photo); $mail->addattachment($photo); // add attachments the image path shows in url: photo_send=images%2ffullscreen%2f1.jpg%3flol%3dlol when put path directly in addattachment works. if can suggest or give advise, i'd appreciate it! i said in comments, path not ok. you said, if output $photo right after $_get images/fullscreen/1.jpg?lol=lol when discovered need remove ?lol=lol , found problem.

c# - Is it possible to define our own asp controls in bound field like Template field? -

this question may repetition.but haven't got answer question : difference between bound field , template field?.i have asp gridview.i had found bound field used bind data directly using header text , datafield out using controls. template field public void instantiatein(system.web.ui.control container) { //code } bound field protected override void initializedatacell(datacontrolfieldcell cell, datacontrolrowstate rowstate) { //code } templatefield more flexible boundfield. both of them add 1 column gridview, templatefield allow customize column. by example, can add validation controls in edit template validate textbox control. can add complex tables column. you dont have flexibility in boundcolumn summary : if displaying data should using boundfield. if requirement include editing data should use template field. templatefield represents field displays custom content in data-bound control. boundfield represent...

javascript - Answering Angular requests with restify -

so trying build restify backend answer these angularjs calls. problem angular sends data via request payload (chrome dev tools | no idea is). angularjs call: var userdetails = { username:"username", password:"password" } $http.post('http://localhost:8080/login',userdetails,{}).success(function(data){}); as far know restify can access data saved in url http://localhost:8080/login/username/password here use: server.post("/login/:username/:password", function(req,res,next){ console.log(req.params); }); but how can access request payload? if not possible can angular make calls fit restify.

php - User class not returning duplicate emails as false in database -

i've made user class validates data passed through form , subsequently updates database table users. want add functionality such checking if username , email exists in table, i've acquired members of stackoverflow in order start building this, below code still allowing duplicate emails inserted database, don't sql error messages success message follows "1 row inserted." expect error message "email exists" any helpful. public function insert() { $result = $this->mysqli->prepare("select count(*) users email=?"); $result->bind_param("s", $_post['email']); $result->execute(); $result->bind_result($email_count); $result->close(); if ($email_count > 0) { echo "email exisits!"; } else { //escape post data added protection $username = isset($_post['username']) ? $this->mysqli->real_escape_string($_post['username']) : ''; $cryptedpassword = crypt($_post[...

c# - how to convert html page to pdf with css using itextsharp? -

this code : response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=testpage.pdf"); response.cache.setcacheability(httpcacheability.nocache); stringwriter sw = new stringwriter(); htmltextwriter hw = new htmltextwriter(sw); this.page.rendercontrol(hw); stringreader sr = new stringreader(sw.tostring()); document pdfdoc = new document(pagesize.a4, 10f, 10f, 100f, 0f); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); **htmlparser.parse(sr);** //the exception here pdfdoc.close(); response.write(pdfdoc); response.end(); the error : unable cast object of type 'itextsharp.text.html.simpleparser.cellwrapper' type 'itextsharp.text.paragraph'. what exception ? i don't know if answer, found itextsharp picky having valid html. tests had table opened twice , never closed , took hour me notice. excep...

excel - Find function - error 91 -

i use code find value in range. works fine if searched value of single digit or text. "error 91 object variable or block not set" whenever searched value of 2 digits. tell wrong? make things clear have uploaded file here: https://www.dropbox.com/s/5nkja2xumcyap73/find%20error%2091%20for%20double%20digits.xlsm appreciated! dim search_range range dim search_start range dim search_value range set search_range = shdaten.range("e1:t1") set search_start = shdaten.range("e1") set search_value = search_range.find(what:=shschl.range("d25").value, after:=search_start, _ lookin:=xlvalues, lookat:=xlpart, searchorder:=xlbyrows, _ searchdirection:=xlnext, matchcase:=false, searchformat:=false) error found! cells contain searched value must formated "text" (by right click on cells/range , go "format cell" , select "text").

Widevine DRM on Windows 8 modern app is it possible? -

we need play widevine or/and verimatrix drm content on windows 8 modern application. have problems this? if yes, solutions achieve goal? need buy more product? according site, widevine support microsoft windows , didn't find explicit mention of windows 8 there. however, best of knowledge have been supporting windows 8 right start. for official answer, should ask them directly.

css - Html border-separator in header between ul-li tags -

Image
look @ problem: now have: what need do: i tryed border, nothing happends. here code: <ul id="tabmenu"> <li class="dropdown"><div><a class="tab1"><div class="dropdown_text">поиск по производителю</div></a></div></li> <li class="dropdown"><div><a class="tab2"><div class="dropdown_text">поиск по назначению</div></a></div></li> <li class="dropdown"><div id="menu_logo"></div></li> <li class="dropdown"><div><a class="tab3"><div class="dropdown_text">кабинет</div></a></div></li> <li class="dropdown"><div><a class="tab5"><div class="dropdown_text">сравнение</div></a></div></li> <li class="dropdown"...

networking - Remote debugger over SSH tunnel -

i communicating server behind microsoft forefront , in need connect visual studio remote debugger located on server. development computer located outside of microsoft forefront , therefor quite troublesome. far have managed make connection visual studio on machine outside forefront remote debugger on server inside forefront. can see in remote debugger monitor connection successful. "domain\jens connected" says. visual studio client still waiting , after while complain "unable connect visual studio debugging monitor named jens@server. visual studio debugger on target computer cannot connect computer" to set far have tried tunnel remote debugger connection using putty. have set putty connect linux-server outside microsoft forefront network. in putty have set following forwards (123.123.123.123 linux-server outside forefront): 4r123.123.123.123:135 localhost:135 4r123.123.123.123:137 localhost:137 4r123.123.123.123:138 localhost:138 4r123.123.123...

ios - Getting Bad Access Error -

i using cashapelayer , uibezierpath in application. have reload button. when reloading view several times, giving me exc_bad_access error. here code : self.layer.sublayers = nil; nsinteger numofdays = [self differencebetweentwodatesfromdate:startdate todate:enddate]; cgfloat widthofcomponent = numofdays * daywidth; if (self.frame.size.width > widthofcomponent) { dlog(@"%@",nsstringfromcgrect(self.frame)) widthofcomponent = self.frame.size.width - 2 * difference_from_origin; daywidth = widthofcomponent/numofdays; } self.frame = cgrectmake(self.frame.origin.x, self.frame.origin.y, widthofcomponent, self.frame.size.height); [self reloaddata]; [super layoutsubviews]; i getting error when passing new frame self.frame . it's caused self.layer.sublayers = nil . indiscriminately removing sublayers causes nasty crashes in ios 7, can occur later in program's execution. have tested thoroughly using both rootlayer.sublayers = nil , [rootlayer...

android - Common styles for v10 and v11+? -

i'm using v7 support library in order have actionbar on api level 10+ (that's android 2.3.3+). now, want customize bit, added application theme. excerpt of values/styles.xml : <style name="apptheme" parent="theme.appcompat.light"> <item name="actionbarstyle">@style/actionbarstyle</item> </style> <style name="actionbarstyle" parent="@style/widget.appcompat.actionbar"> <item name="background">@drawable/bg_actionbar</item> </style> this works fine on android 2.3.3, compat stuff used. however, on android 4.3 on n4 (or emulator), styles not applied. if change styles.xml file to: <style name="apptheme" parent="theme.appcompat.light"> <item name="android:actionbarstyle">@style/actionbarstyle</item> </style> <style name="actionbarstyle" parent="@style/widget.appcompat.actionbar"...

Cannot locate mysql instance in Solaris 10 -

i working on system setup admin. solaris webstack setup. using commands such svcs -a|grep apache can see apache running or svcs -a|grep postgresql shows me postgres disabled. svcs -a|grep mysql command nothing. hops on next line prompt waiting input! mysql databases can see located on solaris computer networked fedora computer running other applications. windows clients networked solaris have applications whcih based on mysql running normal. clue? want access mysql commandline on solaris says mysql : not found! svcs shows service if serivce building smf (service management facility). in classic model service using control-scripts /etc/init.d/ error message "command not found" maybe occurred if path variable not contains paths stored mysql, example: /usr/local/bin/mysql. if sure server solaris installed mysql - try find mysql file on file system. for find run command: find / -type f -name mysql

python - Python3 : unescaping non ascii characters -

(python 3.3.2) have unescape non ascii escaped characters returned call re.escape(). see here , here methods doesn't work. i'm working in 100% utf-8 environment. # pure ascii string : ok mystring = "a\n" # expected unescaped string : "a\n" cod = codecs.getencoder('unicode_escape') print( cod(mystring) ) # non ascii string : method #1 mystring = "€\n" # equivalent : mystring = codecs.unicode_escape_decode(mystring) cod = codecs.getdecoder('unicode_escape') print(cod(mystring)) # result = ('â\x82¬\n', 5) instead of ("€\n", 2) # non ascii string : method #2 mystring = "€\n" mystring = bytes(mystring, 'utf-8').decode('unicode_escape') print(mystring) # result = â\202¬ instead of "€\n" is bug ? have misunderstood ? any appreciated ! ps : edited post michael foukarakis' remark. you seem misunderstand encodings. protected against common errors, encode stri...

html - Embedding SSRS Report Viewer in a webpage -

i want create in website navigation ssrs. have left panel reports have , on right have div report user selected. can embedded ssrs report viewer in html div? the report viewer see when going to: http://<server>/reportserver/pages/reportviewer.aspx?%2f<path>%2f<reportname>&rs:command=render also, can pass username in url? tried user http://<server>/reportserver/pages/reportviewer.aspx?%2f<path>%2f<reportname>&rs:command=render&userid='username' and error: an attempt made set report parameter 'userid' not defined in report. (rsunknownreportparameter) thanks more info: i using dataextensions , userid gives me database need connect to. in winforms can use microsoft.reporting.winforms.datasourcecredentials object specify db, in webform can't use datasourcecredentials (readonly) any ideas? (rsunknownreportparameter) means trying set report parameter not exist. suggest looking @ report aga...

ruby on rails - Why does current_user session become nil when updating a user? -

i'm using devise , cancan user authentication , administrating roles restricting access parts of rails 4 app users. i've run problems updating user. update works fine , user object in db updated should, user session lost on following redirect_to user show action. current_user becomes nil means cancan restricts access user show action. why current_user become nil after update, when not happen on other actions (e.g create, destroy etc.)? these devise settings in user model: devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:login] this users_controller.rb's update method: class userscontroller < applicationcontroller load_and_authorize_resource before_filter :authenticate_user! def update @user = user.find(params[:id]) if params[:user][:password].blank? params[:user].delete(:password) end respond_to |format| if @user.update_attr...

ruby on rails - How to set different page size for the first page in Kaminari? -

i have number of objects paginate using kaminari. however, on first page show notification allowing viewer create own object, reducing number of objects can displayed on page. however, indicated number of pages should take account first page contains less elements. let's objects letters through z. first page should 4 display letters: {a,b,c,d} , while other pages should show 6 letters: {e,f,g,h,i,j}, {k,l,m,n,o,p}, etc... i've been looking @ padding , offset functions, have not yet been able produce wanted results these. @page current page if @page == 1 alphabet.page(@page).per(4) else alphabet.page(@page).per(6).padding(2) end => {a,b,c,d},{i,j,k,l,m,n}, etc... if @page == 1 alphabet.page(@page).per(4) else alphabet.page(@page).per(6).offset(4) end => {a,b,c,d},{e,f,g,h,i,j}, {e,f,g,h,i,j} etc... offset method not set current_page correctly, not seem correct method. how can pagination looks {a,b,c,d}, {e,f,g,h,i,j}, {k,l,m,n,o,p}, etc... ,...

mysql - INSERT command denied to user -

i wrote script brother seamlessly execute on server, , after moving throws error : insert command denied user 'nemesisp_user'@'localhost' table 'rekrutacja' although in cpanel 1 user created (along installation of joomla) , has privileges google theards nothing helped. edit: first this: use nemesisp_joomla; then try using grant once have selected database: grant insert on nemesisp_joomla.rekrutacja 'nemesisp_user'@'localhost';

javascript - Append for loop to div in html -

so i'm trying learn javascript , think have working json script loop grab data i'm having trouble figuring out how append data div. after figure out i'm going redo in jquery (because i'm trying learn well). let's div id #wrapper for (var = 0; < providerlisting.length; i++) { document.write('<div class="entry panel row"> \ <div class="large-4 columns first"> \ <div class="name">' + providerlisting[i].nametitle + '</div> \ <div class="specialty">' + providerlisting[i].caretype + '</div> \ <div class="peferred">' + providerlisting[i].preferredprovider + '</div> \ </div> \ <div class="large-3 columns second"> \ <div class="address">' + providerlisting[i].address1 + '<br /> \ ' + providerlisting[i].ad...

jsf 2 - How to configure JAAS in JBoss AS 7 to accept only ONE SESSION PER USER? -

i got jboss work jaas authentication jsf application. seemed work fine when realized capable of logging in same user in different computers/browsers. i wondering if there configuration missing make understand can't allow more 1 session per user. at first, thought pretty straightforward, though that's not realized later. been reading 2 days @ jboss community website , in here. here how configuration in standalone.xml looks like: <security-domain name="***realm" cache-type="default"> <authentication> <login-module code="database" flag="required"> <module-option name="dsjndiname" value="java:jboss/datasources/***ds"/> <module-option name="principalsquery" value="select password users email=?"/> <module-option name="rolesquery" value="sel...

Manage stdout and stdin in ipython notebook -

a short ipython notebook cell: %%bash read value 5 echo "value: $value" the output cell value: 5 possible introduce value interactively using ipython notebook? if try run this: %%bash ssh user@host pwd since first time trying connect host , ssh launches question: are sure want continue connecting (yes/no)? but question printed in shell started ipython notebook, , not in notebook itself. , here can write answer in shell. would possible display output , introduce answer through notebook web interface? this frustrating aspect of notebook, there's (now merged) pull request provide ability interactive stdin within notebook. make use of you'd have install master branch believe.

kendo ui - Force DropDownList to use list instead of ActionSheet for mobile -

i'm working on ipad app using kendo , dropdownlist throwing actionsheet. i'd force use web ui list style. how can this? for interested able hack solution. here's function accepts kendomobileview argument , applies fix. //hack force dropdowns act comboboxes in mobile! utils.fix.dropdownlists = function(view) { var dropdowns = view.element.find("[data-role='dropdownlist']"); //iterate through dropdown elements _.each(dropdowns, function(item){ var comp = $(item).data("kendodropdownlist"); if(comp && comp.popup) { comp.popup.bind("open", function(event){ event.sender.element.parent().removeclass("km-popup km-widget"); if(event.sender.element.parent().hasclass("km-popup")) { //prevent default open animation. //then remove classes , open popup programitcally //easy peasy, le...

c++ - QVector with struct - performance + best practise -

i'm having set of approximately 150 variables can have different type (double, bool, array). set of variables need pack qvector. because of type variables vary thought of using qvariant. far design. i'm not sure performance + search mechanism of myvariables. enum class variableenums{ var1, var2, var3 }; struct myvariable{ variableenums var; qvariant value; }; qvector<myvariable> myvariables; the idea myvariables send several modules. each module find specific variable , update other variable. 1 module can update variable used module. far regarding searching specific variable can think following: foreach(myvariable *myvar, myvariables{ if(myvar->var == variableenums::var1){ //...... continue; } } is there more effective way this? use indexof, i'm not sure how use structure. thanks, m. you consider using multimap instead of qvector. multimap can map variables like: crude representation: { var1, var1, b ...

android java not enough sequential memory for stringbuilder -

my app parsing large http response, http response on 6 megabytes , json, not in standard schema. final char[] buffer = new char[0x10000]; stringbuilder out = new stringbuilder(); reader in = new inputstreamreader(is, "utf-8"); int read; system.gc(); { read = in.read(buffer, 0, buffer.length); if (read > 0) { out.append(buffer, 0, read); } } while (read >= 0); in.close(); is.close(); in = null; = null; system.gc(); return out.tostring(); it doesn't matter if there bufferedreader file, or inputstream, stringbuilder cannot contain entire object , fails @ out.append(buffer, 0, read); or fail @ out.tostring() copy may made ioutils.copy apache library doing same things under hood , fail. how can read large object in further manipulation. right method fails on android 2.2 , 2.3 devices...

preg replace - How to encode url by using preg_replace function in php? -

i have follow code: $content = preg_replace('/<a href="http:\/\/domain.com\/view\/img\/(.*)">text<\/a>/', '<a href="http://mydomain.com/get.php?url='.base64_encode('{$1}').'">text</a>', $content); thanks much. if using php, think have scape ". try with: $content = preg_replace('/<a href=\"http:\/\/domain.com\/view\/img\/(.*)\">text<\/a>/', '<a href="http://mydomain.com/get.php?url='.base64_encode('{$1}').'">text</a>', $content);

javascript - How to call a web api via ajax over SSL from a local html file? -

i have local html file in may desktop accessing web api (jax-rs) responds json data. enabled cors , works fine, without ssl. how can make work ssl? use self-signed certificate , can call web api wpf application, javascript application (standalone html file), when chrome sends options pre-flight before post, request seems not reach server. tried import self-signed certificate in browser, nothing has changed. the preflight request not allowed include entity body or credentials. if using preflighted requests cannot use 2 way ssl. the solution change server make certificate optional. i've done using apache http server or tomcat assume other servers capable of this. in apache setting should changed to sslverifyclient optional and in tomcat ssl settings should changed to clientauth="want" without change cors simple requests work.

Android - What is the correct way of turning off screen -

this little bit tricky. background : there old galaxynexus power button not functioning well. have press hard turn on/off screen , annoying! solution : have downloaded newest aosp , build own firmware images. modified 2 places handle problem. 1- in function interceptkeybeforequeueing() of phonewindowmanager, add following handling codes: if(keycode == keyevent.keycode_volume_up || keycode == keyevent.keycode_volume_down) { if(event.getaction() == keyevent.action_up && !mpowermanager.isscreenon()) { return action_wake_up; } } 2- in status bar source code, modified call when long-press home button. change triggering google assistant turn off screen (apology google). in function ontrigger() in searchpanelview, modified code below: //startassistactivity(); vibrate(); powermanager pm = (powermanager)mcontext.getsystemservice(context.power_service); if(pm.isscreenon()) { pm.gotosleep(systemclock.uptimemillis()); } i have comment out original code...

php - Count Facebook-users with a certain name -

i want check name facebook display how many users on facebook (generally) same name. i'ld display on website. i know it's possible, see on different websites information: +/- 14225 zoltan's on facebook (position #4454) but have no idea can find script this. searched everywere couldn't find anything. there can me, please? the near results can using graph api using- http://graph.facebook.com/search?q=jeroen&type=user (needs valid access_token)

Can we change the text of a permission in android -

i know sounds silly , not technical question, but, think, important know , best place. have searched abit before posting here. can change text of permission? let's using permission, "get_accounts". display, "your accounts" , "discover known accounts", user when installs application. let's want inform user, permission being used "push notifications" , hence want change to, "used push notifications" instead of "discover known accounts". can this? i know if permitted, developer can write ever want, but, in sense, clear doubts users have while installing application. thanks help.. i don't think so. noticed many cases developers put in description of app on google play (somewhere @ bottom), permissions app require along explanation. of course there's no guarantee users read app description, but, it's still way tell users why need permissions.

asp.net - Create a control based on value in a DB -

i need create dynamically built page in asp.net app (using vb). page collects parameter information report. the report information such name, stored procedure , required parameters in db table. in table have field 'control_type' hoping can use type of control need create collect relevant parameter value selected report. so, if select report01, row form db report01 , parameter data reports row tells me need collect integer value parameter called i_company_id , control create select value form (on dynamically created parameters page) says 'dropdownlist'. if row db , place filed value variable, can like dim ddl new varaiblename and can populate list normal , then panel.controls.add(ddl) the key bit being able create control type of control create in variable or other dynamically defined way. i understand following solution delivers want: private function createvariable(inputname string) object dim outvariable object = new object if (in...

java - Can I use an Image variable in a Mouse method instead of specific x- and y-values? [Might be Slick2D only] -

i've been creating app me understand java more , 1 of things coded ability change settings (resolution, music loudness, fps limit etc...) values (1280x720, 0-10, vsync). i've drawn images in photoshop , added them in class files, gave them place in code rendered on screen. if((xpos>400 && xpos<600) && (ypos>255 && ypos<305)){ if(mouse.isbuttondown(0)){ this part of code matters, have manually search boundaries of images , simple math figure out coordinates need use, designed music loudness have 11 seperate images, 1 each value (0-10). there simpler way let java know "if cursor on image, this" or doomed code in seperate coordinates 11 times (and more times other settings. please let me know if there's better way of doing this! thanks. p.s. can't seem find how draw drop-down menu slick2d , lwjgl. can still use standard java code draw drop-down menu or should library such swing job me? make imageholde...

ruby on rails - Polymorphic has_many :through NoMethodError: undefined method `klass' for nil:NilClass -

so started setup has_many :through polymorphic association in app. models following: class song < activerecord::base has_many :collections, through: :collectionitems has_many :collectionitems, through: :collectable end class album < activerecord::base has_many :collections, through: :collectionitems has_many :collectionitems, through: :collectable end class collection < activerecord::base has_many :albums, through: :collectionitems, source: :collectable, source_type: "album" has_many :songs, through: :collectionitems, source: :collectable, source_type: "song" has_many :collectionitems end class collectionitem < activerecord::base belongs_to :collection belongs_to :collectable, polymorphic: true end this allows me following calls: collection.first.songs => returns array of songs first collection collection.first.albums => returns array of albums first collection collectionitem.first.collection => returns collecti...

ios - Using CocoaHTTPServer to "send" a message -

i using cocoahttpserver in macosx app (server) serves local directory of images. have corresponding ios app (client) uses afhttprequestoperation (afnetworking) retrieve image file mac on local network. working well. what next is, when user chooses specific image in mac app ipad app notified download image , display it. the method employ serve simple imagetodisplay.txt file includes file name of image display. ipad app polling file, , if filename changes downloads it, etc. works seems clunky. have thought of implementing method on server return filename. approach still require polling client. is there more elegant way trigger download (without polling) pieces have in place? essentially sending message server client - "download image27.jpg now" websockets (socketrocket) there few ways implement this. noted in comments, websockets one. robust freely available websockets library ios socketrocket (which rhymes). there ample sample (also rhymes) code on...

css - What's the correct markup for stacked fontawesome icons as a bulleted list? -

i want use fontawesome icons in bulleted list. guide provides markup below: <ul class="icons-ul"> <li><i class="icon-li icon-ok"></i>bulleted lists (like one)</li> <li><i class="icon-li icon-ok"></i>buttons</li> <li><i class="icon-li icon-ok"></i>button groups</li> <li><i class="icon-li icon-ok"></i>navigation</li> <li><i class="icon-li icon-ok"></i>prepended form inputs</li> <li><i class="icon-li icon-ok"></i>&hellip;and many more custom css</li> </ul> simples. eh? however, instead of plain old icons, want use font awesome stack. comme ca: <span class="icon-stack"> <i class="icon-check-empty icon-stack-base"></i> <i class="icon-twitter"></i> </span> question is; how ...

python 3.x - Impossible to remove \n and \t in python3 string? -

so been trying format taken webpage cl can send email, come every time try remove \n , \t b'\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n\n\t\n\n\n\t \n\t\t\t \n\t \n\t\t \n\t\t\t \n 0 favorites\n \n\n\t\t \n\t\t ∨ \n\t\t ∧ \n\t\t \n \n \n \n\t \tcl wenatchee personals casual encounters\n \n \n\t\t \n\t \n \n\n\t\t \n\t\t\t \n\t\n\t\t\n\t\n\n\n\nreply to: 59nv6-4031116628@pers.craigslist.org\n \n\n\n\t \n\t\n\t\tflag [?] :\n\t\t\n\t\t\tmiscategorized\n\t\t\n\t\t\tprohibited\n\t\t\n\t\t\tspam\n\t\t\n\t\t\tbest of\n\t\n \n\n\t\t posted: 2013-08-28, 8:23am pdt \n \n\n \n \n well... - w4m - 22 (wenatchee)\n i have tried strip, replace , regex nothing fazes it, comes in email unaffected everything. here's code: try: if url.find('http://') == -1: url = 'http://wenatchee.craigslist.org' + url html = urlopen(url).read() html = str(html) html = re.sub('\s+',' ', html) print(html) part2 = mimetext(html, 'html') ...

sql - ERROR: could not access file "$libdir/postgis-2.0" postgresapp -

i running postgresapp 9.2.4.3 , postgis , trying add geometry column table. postgis extension running. when run: select addgeometrycolumn('public'::varchar,'gloutline'::varchar,'geom'::varchar,'4326','multipoly on','2'); i'm getting following errors: error: not access file "$libdir/postgis-2.0": no such file or directory line 1: alter table public.gloutline add column geom geometry(multip... query: alter table public.gloutline add column geom geometry(multipolygon, 4326) context: pl/pgsql function addgeometrycolumn(character varying,character varying,character varying,character varying,integer,character varying,integer,boolean) line 110 @ execute statement sql statement "select addgeometrycolumn('',$1,$2,$3,$4,$5,$6,$7)" pl/pgsql function addgeometrycolumn(character varying,character varying,character varying,integer,character varying,integer,boolean) line 5 @ sql statement a reinsta...

how do i add different custom right sidebars with different widths and content on different pages in wordpress? -

i have afew pages in wordpress need different custom right sidebars on different css styles. example homepage right sidebar set width 100px , displaying specific content , id have special offers page right sidebar thats different width 230px displaying different content widgets etc... to understanding should able achieved creating custom sidebars registering them wordpress function , creating custom sidebar template php file different css class sidebar. , calling new custom sidebar template file inside of custom page template file being applied target page in wordpress page loads custom sidebar template instead of normal sidebar template new css class can modified achieve different sidebar styles different pages. created following custom sidebar template , called customrightsidebar.php <div id="sidebar3"><div class="sidebar3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('customright-sidebar') ) : ?>...

How can I make SWIG for Lua create a binary operators with a scalar as left argument and custom class on the right? -

the swig documentation shows how overload operators. example have of complex class , show how overload operator+. have example talking mixing double , complex. example given, though defines complex operator+(double, const complex &) , works complex+double. take following example: a = complex(2,3); b = a+3; print(b); b = 3+a; print(b); the output follows: <complex userdata: 7ffe30c47438> not execute script file test.lua: error in complex::__add__ (arg 1), expected 'complex *' got 'number' the first line of output result of first call print(b) . call 3+a fails. how can make swig generate code work when left hand side scalar , complex on right hand side?

c# - Export Radgrid Mastertableview Data with Client-side binding -

i have radgrid contains mastertableview. on top of mastertableview there form user search data results used data source bind mastertableview. when user clicks search button in form, javascript function invoked call web service method result data set. somehow web service method returns current page's amount of data. meanwhile, no matter items selected in mastertableview user, exporting buttons export same set of data. because data bounded using javascript in client side exporting code c#, looking way export items selected user or if no items selected exporting data instead of data residing in current page. thanks in advance. this happens when using simple data-binding . have use advanced data-binding (or datasource control) in order functionality work properly: please note use export functionality grid must configured use advanced databinding in contrast simple databind not support exporting.

sql - Python Peewee execute_sql() example -

i using peewee module orm project. i read entire documentation, there no clear example on how process result db.execute_sql(). i traced code, can find db.execute_sql() return cursor. does knows how process cursor, such iterate on , result complex select statement. update: found following source code peewee folder, should me resolve problem. class queryresultwrapper(object): """ provides iterator on results of raw query, additionally doing 2 things: - converts rows database python representations - ensures multiple iterations not result in multiple queries """ def __init__(self, model, cursor, meta=none): self.model = model self.cursor = cursor self.__ct = 0 self.__idx = 0 self._result_cache = [] self._populated = false self._initialized = false if meta not none: self.column_meta, self.join_meta = meta else: self.colu...

c# - Cannot Group By on multiple columns and Count -

i want write simple query linq: select issuercode,securitycode,dataprocessingflag,count(issuercode) cnt cmr_invhdr processedlike <> 'stmnt only' group issuercode,securitycode,dataprocessingflag order issuercode i've tried following code error( dbexpressionbinding requires input expression collection resulttype. parameter name: input) : var lstcmrinvhdrnips = (from r in e.cmr_invhdr r.processedlike != "stmnt only" select new { r.issuercode, r.securitycode, countofissuercode = r.issuercode.count(), r.dataprocessingflag } ).groupby(x => new { x.issuercode, ...