Posts

Showing posts from January, 2013

Rotate WPF control or change screen orientation -

i have wpf project 1 window (mainwindow). depending upon config file shows 1 of 2 usercontrol's content. may horizontal (1920x1080) control or vertical (1080x1920) control. it's fine horizontal screen, when vertical loaded do: 1) rotate window/control 270 degrees 2) change primary screen orientation i prefer rotate application , don't interact windows api. can't change orientation manually, because have remote access computer. you can not rotate window object itself, positioned window management system built in windows. can, however, transform (and rotate) frameworkelement inside window. includes, not limited to, grid , button , textbox elements. all need edit layouttransform property on element want rotate, root element in window. set rotation 270/-90 degrees , wpf automatically rotate ui. because using layouttransform property, layout system scale ui correctly. rendertransform property causes control first rendered, rotated.

c++ - Using gcc attributes with C++11 attributes syntax -

i trying use gcc attributes c++11 syntax . example this: static void [[used]] foo(void) { // ... } but following: warning: ‘used’ attribute ignored [-wattributes] static void [[used]] foo(void) ^ why attribute ignored? possible use gcc attributes c++ attributes? [[gnu::used]] static void foo(void) {} first, attribute can appear in specific places, otherwise get: x.cc:1:13: warning: attribute ignored [-wattributes] static void [[gnu::used]] foo(void) {} ^ x.cc:1:13: note: attribute appertains type-specifier ignored second, used not standard warning, gets hidden in proprietary namespace gnu:: .

F# concatenate int array option to string -

i have data contract (wcf) field defined as: [<datacontract(namespace = _namespace.ws)>] type commitrequest = { // excluded brevity ... [<field: datamember(name="excludelist", isrequired=false) >] excludelist : int array option } i want entries in excludelist, create comma separated string (to reduce number of network hops database update status). have tried following 2 approaches, neither of create desired string, both empty: // logic determine if need execute block works correctly try // use f# concat let strlist = request.excludelist.value |> array.map string let idstring = string.concat ",", strlist // next try using .net join let idlist = string.join ((",", (request.excludelist.value.select (fun f -> f)).distinct).tostring ()) | ex -> ... both compile , execute neither give me in string. appreciate pointing out doing wrong here. let intoarray : int array option = [| 1; 23; 16 |] let s

c# - Awesomium freezes / not responding -

i have traffic exchange website , want convert windows application using c# winform awesomium 1.7.5. basic setup ready there problem awesomium. after visiting few websites slows down , freezes entirely ( not responding ). public form1() { initializecomponent(); text = "traffic exchange"; windowstate = formwindowstate.maximized; timer1 = new system.windows.forms.timer(); timer1.tick += new eventhandler(timer1_tick); int user_id = properties.settings.default.user_id; string user_id_s = user_id.tostring(); toolstriplabel2.text = user_id_s; if (properties.settings.default.user_id == 0) { toolstriplabel3.visible = true; toolstripbutton3.visible = false; } else { toolstripbutton3.visible = true; toolstriplabel3.visible = false;

excel - Creating a chart and adding new series to it -

i trying add new chart workbook using code below. however, every time try run it, error object doesn't support property or method on name property. tried use qualified workbook name still no luck. code: charts.add activechart.seriescollection.newseries .name = activesheet.range("a2") .values = activesheet.range("b2:ak2") .xvalues = activehsheet.range("a2:a7") end i tried using code in following way: charts.add activechart.seriescollection.newseries .name = finalviewswbk.sheets(1).range(finalviewswbk.sheets(1).cells(2, 1)) .values = finalviewswbk.sheets(1).range("b2:ak2") .xvalues = finalviewswbk.sheets(1).range("a2:a7") end

php - ZF2 share models between modules -

hi i'm trying share models between modules, when call getservicelocator()->get('mail\model\mail') in controller module class cannot found. i'm searching solution few days now, can't find 1 thats working me. public function getserviceconfig() { return array( 'factories' => array( 'mail\model\mail' => function($sm) { $mail = new mail(); return $mail; }, 'mail\model\mailtable' => function($sm) { $tablegateway = $sm->get('mailtablegateway'); $table = new mailtable($tablegateway); return $table; }, 'mailtablegateway' => function($sm) { $dbadapter = $sm->get('zend\db\adapter\adapter'); $resultsetprototype = new resultset(); $resultsetprototype->setarrayobjectprototype(new mail());

android - Calling finish() after launching another activity only works sometimes -

i have splash screen handles automatic login. if user logged in, sends s/he directly main activity, through following code: intent intent = new intent(activity, mainactivity.class); activity.startactivity(intent); activity.finish(); where activity activity finished (i'm not using this because method common automatic logins, manual logins, social logins etc.) however 70% of time, splash screen still there after finishing main activity. not occur during debugging. looks happens when login happens quickly, why never happens during debugging (because becomes slow). logging has helped see that, when problem happens finish() indeed being called, ondestroy() not. i have tried flag_activity_clear_top , doesn't help. nohistory work, brings unwanted finishing animation and, really, want know problem code is. i've used , don't see why fails. thanks in advance.

javascript - How to order SQLite database alphabetically -

i have sqlite database in french utf-8 encoding , trying organize categories in alphabetical order. setup looks like: http://i.imgur.com/cqnw1es.png i tried add select distinct category 'main database' order name unfortunately did not display correctly. can tell me correct way alphabetize category column in abc order? javascript: function ondeviceready() { if (window.device.platform === 'ios' && parsefloat(window.device.version) >= 7.0) statusbar.overlayswebview(false); db = window.sqliteplugin.opendatabase({name: "treatfinder", bgtype: 1}); db.transaction(function(tx){ tx.executesql("select distinct category 'main database'",[],function(tx,res){ //console.log("number of categories: " + res.rows.length); var len = res.rows.length; (var i=0; < len; = + 1) { $(

search - Get property dynamically in c -

i'm new c. i'm building tiny "database" while i'm learning. undestand of basics in c, i'm having trouble pointers , arrays. i create simple key-value find function. key entered user argument (argv) when program executed. i'm stuck @ printing specific dynamic columns of row . this: myarray[i][key] // key dynamic, loop here find function: void find(char *key, char *value){ // print intention terminal printf("\nget %s=%s\n", key, value); // rows struct address *rows = conn->db->rows; // list rows int = 0; for(i = 0; < 100; i++){ if(rows[i].set){ printf("rows[%d] = %s\n", i, rows[i][key] ); // <-- how this? } } } here address structure: struct address { int id; int set; char name[512]; char email[512]; }; and here database structure: struct database { struct address rows[100]; }; this close can get: // have return

android - Redirect activity after facebook login -

i'm using android facebook sdk (4.01) login app facebook. facebook login mainactivity succeeds , use intent procced next activity. part works. after in new activity (mainlobby) want able logout facebook , return previous mainactivity, pressing button. reason when press mainlobby closes, has mainlobby activity behind it. have press button twice mainactivity. why that? main activity class code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(getapplicationcontext()); setcontentview(r.layout.main_activity); fbloginbt = (loginbutton) findviewbyid(r.id.fbloginbt); callback = callbackmanager.factory.create(); fbloginbt.registercallback(callback, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { system.out.println("onsuccess"); intent mainlobby = new intent(mainactivity.this, m

Can you get an 2 dimensional array from 3 dimensional array without loops in Java? -

can subarray 3 dimensional array in java? i'm kind of new java , need help. threedimensions[][][] = { { {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, }, { {false, false, false, false}, {false, true, true, false}, {false, true, false, false}, {false, true, false, false}, } }; twodimensions = threedimensions[0]; this way doesn't work there way without looping? your way work, you've got syntax bit wrong. should be boolean[][][] threedimensions = { { {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, }, { {false, false, false, false}, {false, true, true, false}, {false, true, false, false}, {false, true, false, false}, } }; boolean[][] twodimensions = threedimensions[

python 3.x - Imprecise floats in Tupper's self-referential formula -

i trying make python program plots tupper's self-referential formula , have run problems. first program couldn’t handle big floats had handle decided use bigfloats sort out problems. worked, sort of. problem have 540 digits long number needs multiplied bigfloat , when rounds number making inexact cause problems later. have tried raise precision 1000 , still keeps rounding variable. the thing of numbers can processed without bigfloat exact value numbers can neither processed nor bigfloat right now. here 1 of calculations goes wrong (this 1 able processed without bigfloat ): import bigfloat y = 960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370

excel - VBA Object Required Error Trying To Get InnerText -

i trying create code go website, put in data, submit it, , return answer cell in excel. when step through it, works fine, when try run it, run-time error 424; object required. i tried looking answer, not grasping on how quite fix this. issue? how correct it? sub distance() dim ie object ' create internetexplorer object set ie = createobject("internetexplorer.application") ' make visible ie.visible = true ' go site ie.navigate "http://www.distance-cities.com/" ' wait while ie loading... until ie.readystate = 4 doevents loop ie.document.getelementbyid("from").value = "stillwater, ok" ie.document.getelementbyid("to").value = "hollis, ok" ie.document.forms(0).submit until ie.readystate = 4 doevents loop '*below error sheet1.range("e5").value = ie.document.getelementbyid("routemi").innertext ie.quit end sub i apologize if bit messy. thanks help! somethin

angularjs - Can't seem to be able to pass data from one controller to another -

the issue can't seem send information controller 1 controller 2... have service sets/gets data isn't working. actual error i'm getting controller 1's dataservice.getdata not function... when works elsewhere. service 1 (in own file) app.service('dataservice', function() { var data, queried; return { setdata: function(querydata) { this.data = querydata; this.queried = false; }, getdata: function() { this.queried = true; return this.data; } }; }); controller 1 (sending information) app.controller('myctrl', ['$scope', '$location', '$state', function($scope, $location, $state, dataservice) { anotherservice.functionname(function(err, data) { // things here actualservice.doesntwork(function(err, data) { if (!err) { var query = {}; query.somefield = data.somefield;

opengl - Rendering thousands of textred cubes -

i got stuck texturing cubes - searched web , realized way give cube 6 different textures (with gldrawelements) create 24 indices. still faster gldrawarrays, seems quite illogically , horribly slow. understand purpose of gldrawelements deal complex models few indices share different texture coords. but, still pretty confused, because gldrawelements gave me perfomance boost (without effects, shader coloring) 50-67ms 10,000 cubes (gldrawarrays), 25-33ms 100,000 cubes. my question is: have accept it, or there still way come on this? i not know want archieve can try reduce number ob vertices in scene. make more faster. think if cube needs more 1 texture, can store them in texture atlas ans assign each vertex of cube corresponding texture coordinate image in texture atlas. reduce number of texture calls, there 1 texutre. in addition need render vertices/triangles visible user, not need texture of cube. i've found site explains lot of speeding rendering thousands of cube

javascript - How to render UI using php and angular for display and in place update -

<?php $ach_json = json_decode ( $ach, true ); for($i = 0; $i < count ( $ach_json ); $i ++) { echo "<ng:switch on='edit'>"; echo "<div ng:switch-when='true'>"; $title = $ach_json [$i] ['title']; echo "<h3>title $title</h3><br>"; echo "<input type='image' src='http:'..' name='edit' value='$i' ng-click='editclick()'>"; echo "</div>"; echo "<div ng:switch-when='false'>"; echo "title: <input type='text' ng-model='title' value=$title> <br>"; echo "<button ng-click='updaterequest()'>update</button>"; echo "</ng:switch>"; } ?> </form> here display title, when clicks on edit button, change textbox , give user upd

Python: import csv, do math with specific cells, output new columns to new (or same) CSV -

i've been working on days- i have csv looks like: col || col b|| col c|| 0.1 || 0.0 || 0.5 || 0.4 || 60 || 0.6 || 0.3 || -60 || 0.5 || ... 0.2 || -60 || 0.4 || there 25 rows of numbers- vary slightly. want import csv using python, slight math (ex. finding avg between cell a1 , c1) either print new column whole new csv file or add new column beginning of current or (even duplicated) file. know the actual math part easy. it's importing, manipulation, exporting new column cannot get. here's i've tried: 1) first tried importing csv, changing list, reading columns need exporting new csv. issue have when export csv doesn't create columns. adds things single cell (0.111, 1.002, ..). import csv ofile=open('duplicate.csv', "w") writer=csv.writer(ofile, delimiter=',') open('/users/mycsv.csv', 'rb') f: mycsv = csv.reader(f) mycsv = list(mycsv) avg=[] high=[] #average number

How to bypass FastClick with Kendo UI DataViz Chart -

we have web app used ipads , iphones. using fastclick ( https://github.com/ftlabs/fastclick ) eliminate 300ms wait time mobile/tablet users. this makes snappier, interaction chart (using svg rendering) spotty. tapping works, not. ​users need able normal chart interactions tap point see value , toggle series on/off in legend. if disable fastclick, chart tapping works fine. fastclick has built-in way bypass element. add "needsclick" css class, , leaves element alone. put css class on div chart rendered in, each clickable element in chart apparently needs have "needsclick" class added it. is possible? i gave up. added "needsclick" svg elements after chart rendered, , ipad clicking still weird. worked, not consistently. i think these libraries both trying solve same problem , stepping on each other it, removed fastclick. this fastclick 1.0.6 , kendo ui v2015.1.408.

java - android websocket websocketnotconnected error -

i have used java-websocket ( https://github.com/davidiusdadi/java-websocket ) client in android app. i recording audio file , sending server using websocketclient , draft 17. my audio file of 500 kb = 500000 bytes. splitting same 1000 bytes string. so have 500 string. send json server in loop in async task. after sending few messages while call websocketclient.send getting exception saying websocketnotconnected , no onclose or onerror triggered yet. some times works properly. is there solution or other android websocket library suitable above task.

networking - 50% udp packets lost -

i sending/receiving short udp packets between computer (c#) , microcontroller (c++). independently of speed, losing around 50% of udp packets, more, less. in c# using udpclient sending ipendpoint (synchronous) , receiving asynchronously. my buffers big enough , see losses produced in computer both sending , receiving (the micro send many packets receives). trying send/receive around 60 packets per second, can adjust , 10 packets per second have losses. example, sent 20 packets per second, micro receives , sends 15, , computer receives 10 packets per second. we talking local wired ethernet connection of 1 gigabit, short (10ft maybe). sending unicast packets, although in network have multicast video (12 mbps). biggest packet 120 bytes, of them around 30-40 bytes any advice how debug problem or can cause it? thanks. here things consider: is wired connection or wireless connection? fifty percent udp packet loss of course more common in wireless case, though on po

Return a list from items matching in two lists Prolog -

i new prolog , have : compare_list(hours1, hours2, matching) i want return matching hours between lists hours1 , hours2 list matching i can matches not construct list of matches. hours1 may like: [1,2,3], hours2 may like: [2,3], this: matching hours should be: [2,3] help appreciated. i have implemented vennik has suggested , near want. results hours1 : [2,3,5], hours2 : [2,5] give following: matching = [2, 5] ; matching = [2] ; matching = [5] ; matching = [] is possible have first set without producing other 3 results? try this: compare_list([], _, []). compare_list([hour | hours1], hours2, [hour | matching]) :- member(hour, hours2), compare_list(hours1, hours2, matching). compare_list([_ | hours1], hours2, matching) :- compare_list(hours1, hours2, matching). calling compare_list([1,2,3], [1,2], x), !. result in x = [1,2] .

Issue with MySql and the Greek characters using mysql for excel -

i used mysql excel in order import data excel mysql db. when used "select" command in mysql workbench realised greek characters appeared question marks "?" then saved excel file .csv , opened notepad++ in order encode utf8. then used following command , again problem greek chars made worse. load data local infile 'c:/working.csv' table tablexxx character set utf8 fields terminated ';' enclosed '"' lines terminated '\r\n'; can please me out. dead end here!!! try greek character set character set cp869; but should work utf-8 maybe need change settings in notepad++ or in mysql workbench , other programs desire use.

distance - Similarity matching between images using multiple features in Matlab -

in image retrieval matlab project, have extracted 14 features each image, , shown in following table. ** si.no feature name size example values ** 1 feature_1 1x64 {96.02, 100.29, 69.04, 91.23,……89.42} 2 feature_2 1x64 {0.070, 0.0671, 0.0876, …….. 0.065} 3 feature_3 1x64 {0.837, 0.949, 0.992, 1.015 .…. 1.306} 4 feature_4 1x64 { 5.00, 5.831, 8.6023, 6.403,…..8.602} 5 feature_5 1x64 {-18.875, -10.85, -5.12, … 39.2005} 6 feature_6 1x1 0.6465494 7 feature_7 1x1 0.89150039 8 feature_8 1x1 0.888859 9 feature_9 1x1 0.990652599 10 feature_10 1x1 157.8198719 11 feature_11 1x1 0.60112219 12 feature_12 1x1 0.060502114 13 feature_13 1x1 0.139164909 14 feature_14 1x1 5.7084825 the above set of feature single image. compute similarity between 2 i

android - Using "setImageBitmap" and center image to point -

i have dialog box has bitmap image , 2 points it. setting image view using setimagebitmap() . works fine looking re-centre image point passed. ie user clicks on screen , dialog appears image centre of image user clicked view.setimagebitmap(bitmap); view.setcroptopadding(false); thanks

jquery - Refresh Grid.Mvc after update data -

i have such grid mvc: @helper customrendering(int id) { @*<button class="btn btn-primary" onclick="location.href='@url.action("acceptrequest", "tablerequest", new { id = id })'"> accept</button>*@ <button class="btn btn-primary" onclick="postaccept(@id)" id="@id"> accept</button> <button class="btn btn-danger" onclick="setwindowid(@id)" id="@id">decline</button> } @html.grid(model).columns(columns => { columns.add(c => c.username).titled("name").filterable(true); columns.add(c => c.datestart).titled("datestart"); columns.add(c => c.dateend).titled("dateend"); columns.add(c => c.approved).titled("approved");

pygame - Python - Livewires console error -

this third time pygame/livewires has led me website, , let last! after installing 'python 3.1.1' book, 'python programming absolute beginner', installed pygame , livewires. tested pygame entering import pygame and worked running it. however, when tested livewires ' from livewires import games, colors produced no errors in idle, did produce error when ran it. error flicked away quick couldn't see it, recorded , paused @ right time , got error: traceback (most recent call last): file "c:\python31\test", line 1, in , <module> livewires import games, colors file "c:\python34\lib\site-packages\livewires\games.py", line 57, in <module> import pygame, pygame.image, pygame.nixer, pygame.font, pygame.transform importerror: no module named 'pygame.image' something did notice says python34, version have, in error not python31, though problem may somewhere else completely. please not not spelling of '

sql - ORA-06550 error PLS-00103 error -

declare nanid number; vpin varchar2(10 byte); vuse_type varchar2(20 byte); vapp_num varchar2(10 byte); dapp_date date; vdisplay varchar2(3 byte); vapp_status varchar2(10 byte); mshape mdsys.sdo_geometry; /* records exist in dgi not in kiv using anid */ cursor curgetmj select d.anid,d. pin, d.use_type, d.app_num, d.app_date, d.display, d.app_status, d.shape dsdspa.dsd_marijuana@dgi d d.anid not in (select anid kivaprod.marijuana); curgetmj_rec curgetmj%rowtype; begin open curgetmj; loop fetch curgetmj curgetmj_rec; exit when curgetmj%notfound; vanid := curgetmj_rec.anid; vpin := curgetmj_rec.pin; vuse_type := curgetmj_rec.use_type;

listview - Android Custom BaseAdapter -

i have baseadapter display listview section. each row have textview, want add textview each row. in item class , in getview() method, added new string text_id , when call adapter have error: item(string, string) in item cannot applied . public class alphabetlistadapter extends baseadapter { public static abstract class row {} public static final class section extends row { public final string text; public section(string text) { this.text = text; } } public static final class item extends row { public final string text; public final string text_id; public item(string text, string text_id ) { this.text = text; this.text_id = text_id; } } private list<row> rows; public void setrows(list<row> rows) { this.rows = rows; } @override public int getcount() { return rows.size(); } @override public row getitem(int position) { return rows.get(position); } @override public long getitemid(int position) { r

list - How can you use a data created by a python program? -

i've created program gave me list list inside, , want print first element of first list when it, have error tells me list doesn't exist... my program is: def prog1(): f=open("dimer.out","r" ) m=open("dimer3.out","w") g=f.readlines() k in range(len(g)): if "molecular orbital" in g[k]: c=k n in range(c+1, len(g)): m.write(g[n]) if "density matrix" in g[n+1]: break def readmatrix(numberofrows): ci = []; in range(0,numberofrows): ci.append([]); f=open("dimer3.out","r") lines=f.readlines() numberofblocks = math.ceil(numberofrows / 5) in range(0,int(numberofblocks)): j in range(i*(numberofrows+3)+3, i*(numberofrows+3)+3+numberofrows): array = re.split('\s+', lines[j]) k in range(0,len(array)): if

Nested function selector in swift for testing -

here situation , perhaps there easier way this: i'm testing stuff uses notifications , didn't want have define expectations class level optional variables wondering if can make them local variables function in such way notification handler can access them. my attempt make notification handler functions nested functions inside top level test function - i've run selector naming issues i'm not sure need tell notification handler call class fileplayertests: xctestcase { func testfileplayback() { let f1url : nsurl = nsbundle(forclass: fileplayertests.self).urlforresource("test1", withextension: "csv")! let f2url : nsurl = nsbundle(forclass: fileplayertests.self).urlforresource("test2", withextension: "csv")! let f3url : nsurl = nsbundle(forclass: fileplayertests.self).urlforresource("test3", withextension: "csv")! let f1 = dm.createfileplayerfromurl(f1url) let f2 = dm.createfilepla

sql - Multiple sort/filter factors on a Fusion tables query -

i want perform query on google fusion table. let's assume assembling string below variables. works fine if have 1 parameter in var sort_factors . how can add second parameter sort_factors can both (for example) order date descending , limit response 1000 rows? var base = 'https://www.googleapis.com/fusiontables/v2/query?', columns = 'sql=select+lat,lng,date,username,tripid', = '+from+xxxxxxxxxxxxxxxxxxx', sort_factors = '+limit+1000+and+order+by+date+desc', key = '&key=xxxxxxxxxxxxxxxxxxx'; limit isn't sorting, and wrong there , limit has last clause in sql: '+order+by+date+desc+limit+1000' the order of clauses fixed , has be: where group order limit your code seems javascript, better favour , let js handle encoding. possible approach: var base = 'https://www.googleapis.com/fusiontables/v2/query', columns = 'select

Properly leave a chat room in smack Android -

in appilcation using below method leave chat room. public void leavechatroom(string username) { log.i("xmpp chat client", "user left chat room "); if(groupchat != null && groupchat.isjoined()) { try { presence leavepresence = new presence(presence.type.unavailable); leavepresence.setto("groupchat@conference.xxx/" + username); connection.sendpacket(leavepresence); groupchat.leave(); } catch (notconnectedexception e) { e.printstacktrace(); } } } and check whether user joined or not, public boolean isjoinedgroup(string username) { boolean isconnected = false; if(groupchat != null && groupchat.isjoined()) { isconnected = true; log.i("xmpp chat client", "joined true"); } return isconnected; } this works fine if there successful chat server conne

c++ - How to document overloaded functions in Doxygen? -

i getting warning message when documenting overloaded functions. doxygen version 1.8.7 i have implementation class , header class. header class declares 2 virtual functions, second of overloads first. classa.h virtual void dosomething(int i); virtual void dosomething(int i,int j);` the implementation class implements each virtual function, follows classa.cpp void dosomething(int i) { printf ("dosomething: %d", i); } void dosomething(int i,int j) { printf ("dosomething: %d", i); printf ("dosomething: %d", j); } i need document both dosomething functions in doxygen. how do it? i have tried documenting .h file follows: attempt 1: classa.h /*! * \fn void dosomething(int i) * */ virtual void dosomething(int i); ` /*! * \fn void dosomething(int i, int j) * , j */ virtual void dosomething(int i,int j); attempt 2: /*! * \fn void do

How to pass login credentials to "Activiti Explorer" using the post method? -

i'm trying access activiti explorer liferay portlet. idea bypass activiti login adding username , password url. like: <a href="http://localhost:8082/activiti-explorer/#processmodel/50?id_=kermit&pwd_=kermit">vedi grafico</a> disabling login function too, don't think can done. have ideas on how best proceed? thank you! it not idea put user , password in hiperlink. if have clear ideas, best way parameterautologin. ensure have active hook in portal-ext.properties, if not case should add parameterautologin , reboot portal: auto.login.hooks=com.liferay.portal.security.auth.parameterautologin then if portal login screenname put url: http://localhost:8082/path&parameterautologinlogin=test&parameterautologinpassword=test if portal login email put url: http://localhost:8082/path&parameterautologinlogin=test@domain.com&parameterautologinpassword=test this works urls of portal. no matters path.

What data is available to a Facebook app after permissions are granted? -

imagine have mobile app, , create new facebook app, use login users through it. in order log app, users have grant user_likes permission. then, can access user_likes request facebook graph using app_token . i've tested this. also, realized user_likes set "public" shown. user_likes private or friends, not shown. is intented behaviour? mean, if user granted me access user_likes , didn't revoke explicitly permission after that, should able user_likes anyway or no? thanks in advance. you need use user access token, not app access token. that's for.

css - Sass map loop possibilities -

i have pretty long sass map, fragment ( full code in codepen ): $pbcolors: ( pbcyan : ( 50: #e5f5fc, 100: #ccebf9, 200: #99d7f2, 300: #66c3ec, 400: #33afe5, 500: #009dbf, 600: #008cab, 700: #007c98, 800: #006d85, 900: #005d72 ), pbmediumblue: ( 50: #e5f1f8, 100: #cce3f1, 200: #99c7e3, 300: #66aad4, 400: #338ec6, 500: #0072b8, 600: #0065a5, 700: #005a93, 800: #004f80, 900: #00436e ), pbpurple: ( 50: #f5ecf5, 100: #ecd9eb, 200: #d9b2d7, 300: #c68cc3, 400: #b365af, 500: #a03f9b, 600: #90388b, 700: #80327c, 800: #702c6c, 900: #60255d ); i trying write loop create series of classes named after color , shade bg color hex, so .bg-pbmediumblue-100 { background: #cce3f1; } however, syntax must broken since i'm not making leap second level: @each $item, $color in $pbcolors { @each $shade, $value in $item { .bg-#{$shade}-#{$shade} { background-color: map-get(map-get($pbcolors, $item), 50); } } } from 50 of each color, , wrong class name: .bg-pbcyan-pbcy

groovy - Gpath when an expression is true -

from json below, trying write gpath return "state" field when "type" field equal ride_state (i.e. want 2 "open" states) [{ "type": "day", "data": { "id": "7a46a975-5474-4278-a56f-4deadd9a276d", "state": "closed" } }, { "type": "ride_state", "data": { "id": "13f3b625-b39e-4875-b29c-0173712b3c87", "state": "open" } }, { "type": "ride_state", "data": { "id": "b52b5081-e1df-42da-ba76-027c63205f8e", "state": "open" } }] i new groovy , gpath , far haven't been able find way this, please help? with valid json, can done below: def jsonstring = """ [{ "type": "day", "data": { "id": &quo

java - Writing multiple images to ServletOuputStream? -

i've requirement multiple images web service(ex:list) , have write images servletoutputstream. when click on 'view' link invokes servlet , servlet invokes webservice , receives multiple images list. now i'm trying write images servletoutputstream not working.. trying send images zip response.setcontenttype("application/zip"); outputstream os = null; bufferedoutputstream bos = null; zipoutputstream zos = null; try{ os = resp.getoutputstream(); bos = new bufferedoutputstream(os); zos = new zipoutputstream(bos); zos.setlevel(zipoutputstream.stored); sendmultiplefiles(zos, annotcontent,"display"); }catch (ioexception e) { resp.setstatus(httpservletresponse.sc_internal_server_error); } { if (zos != null) { zos.finish(); zos.flush(); } bos.close(); os.close(); } private void sendmultiplefiles(zipoutputstream zos, collection<byte[]> filestosend, string name) throws ioexcepti

python - how to get the index of the largest n values in a multi-dimensional numpy array -

this question has answer here: get indices of n highest values in ndarray 3 answers i want index of largest n values in multi-dimensional numpy array. index of largest n values in one-dimensional numpy array, found this . after test in interactive shell in python, seems bottleneck.argpartsort can't effect on multi-dimensional numpy array. index of largest value in multi-dimensional numpy array, found this . can't largest n. method can give translate multi-dimensional numpy array list of {value:index} (index present tuple), , sort list value, , index it. there more easier or more performance? i don't have access bottleneck , in example using argsort , should able use in same way: #!/usr/bin/env python import numpy np n = 4 = np.random.random(20).reshape(4, 5) print(a) # convert 1d array a_1d = a.flatten() # find indices in 1d array idx_1d = a

javascript - Bootstrap Navbar Not Collapsing for Mobile -

so working on website, heres draft: http://46.101.21.230/ , i've used bootstrap before , not had issue. when page in mobile view, navbar not collapse, goes normal bar. i have jquery , bootstrap.js loaded , language selector dropdown @ top works fine i'm guessing that's not problem. i went onto bootstrap website , got example code , pasted in , still doesn't work. any suggestions? simple solution. using sass , didn't include component animations. in future use this @import "bootstrap/component-animations";

angularjs - Can Angular dir-pagination paginate data dynamically -

i have issue, how use angular dir-paginate paginate data, comes service, how can done if want like, ten regists per page, , load them dynamically page page? the answer question here. author wrote quite reasonable explanation how work data in async mode.

html - Positioning 2 elements on one line with bootstrap -

i have page grid col-md-8 , col-md-4 . trying achieve in col-md-4 section have 2 elements (images thumb) on 1 line going on next line/row 2 images , on. structure of html following: <div class="row"> <div class="col-md-8"> <!-- text here --> </div> <div> <div class="col-md-4"> <div class="tool"> <img src="image.jpg" style="width:100px; height:75px;"> </div> </div> </div> </div> here jsfiddle trying 4 small images right of big image , 2x2 on line. try following code html <div class="row"> <div class="col-md-8"> <img src="http://www.extremetech.com/wp-content/uploads/2013/09/4vln8-640x428.jpg" /> </div> <div class="col-md-4"> <div class="row"> <div class="col-md-6&quo

javascript - Google+ vs Google Identity Platform API -

tl;dr: can explain difference in implementing client-side google login flow between these 2 platforms? the backstory: i've been trying implement client-side google sign in website. first, implemented google+ platform global settings using tags, user session monitored. got info here: https://developers.google.com/+/web/signin/ however, encountered problem site automatically check user login state if user not logged in, resulted in many 'toastr' messages of 'logged out', implemented in signincallback function. pretty annoyting. so did research , stumbled across 'quick start app' , browsed through it. way more complicated guide, many elements documented on google identity platform, here: https://developers.google.com/identity/sign-in/web/reference now don't understand correct way of implementing login - lightweight google+ button tag callback check user state, or robust gip way listeners, gapi instances , all? different these platforms offe

angularjs - REST & MEAN Stack: Filling a Form with saved data -

i´ve got rest api , mean application. users can log in app, email adress , write project database, html form. what want achieve is : when user has written project database, html form should filled data out of database. wanted array should identified users email adress. so here we´ve got html form: <div class="form-group"> <label for="author">author</label> <input type="text" class="form-control" name="author" id="email" value="<%= user.local.email %>" readonly ng-value="email"> </div> <div class="form-group"> <label for="name">projektname</label> <input type="text" class="form-control" name="name" ng-value="name"> </div> <div class="form-group"> <label for="description">beschreibung</label> <input type=&quo

ios - Generate a HMAC swift sdk8.3 using CCHmac() -

before sdk8.3 generating hmac way. error on cchmac() function. since i'm beginner can't figure out how fix it. in advance help! xcode warning: cannot involke 'cchmac' argument list of type (uint32, [cchar]?, uint, [cchar]?, uint, inout[(cunsignedchar)] func generatehmac(key: string, data: string) -> string { let ckey = key.cstringusingencoding(nsutf8stringencoding) let cdata = data.cstringusingencoding(nsutf8stringencoding) var result = [cunsignedchar](count: int(cc_sha512_digest_length), repeatedvalue: 0) cchmac(cchmacalgorithm(kcchmacalgsha512), ckey, strlen(ckey!), cdata, strlen(cdata!), &result) let hash = nsmutablestring() var = 0; < result.count; i++ { hash.appendformat("%02hhx", result[i]) } return hash string } the problem strlen returns uint , while cchmac ’s length arguments int s. while coercion, may use count property of 2 arrays rather calling strlen . func generateh

angularjs - Double loop, display no results if nothing to dispay -

using angularjs, have double loop display data, , filter year. when, given year, have no results, want display message "no results...", because of double loop, i'm not able work here demo http://plnkr.co/edit/oswsyxk8bnvmj1rfwhj0?p=preview the div want display when <div ng-if="personnes.length < 1" class="noresults">no results</div> to see example no results, choose "2013-2014" in year dropdown thanks lot well, not pretty like, anyways. update html follows: <div ng-if="filterarray(resultspersonnes).length < 1 && $first" class="noresults">no results</div> and in controller create new function: $scope.filterarray = function(resultspersonnes) { return resultspersonnes.filter(function(prop) { return prop.fraiss[0].annee == $scope.annee.id; }); } so repeats angular in ng-repeat filters. see updated demo .

c# - mvc controller read signalr value -

we using asp.net mvc signalr communicate browser's client side code. currently our hub built as: public class sectionhub : hub { } mvc controller gets reference it. , within loop uses hub notify client when steps done: var progresshub = globalhost.connectionmanager.gethubcontext<sectionhub>(); progresshub.clients.all.updatecurrentprogress(....) all works fine. adding stop button on client , want notify mvc controller stop process when it's clicked. updated sectionhub include property client able update. however, since progresshub object ihubcontext not have access property. there anyway new property hub , have accessible in mvc controller, or create hub sectionhub rather ihubcontext? you should not have kind of logic in hub, hub should used push state. move code background worker, let mvc controller action queue work , return directly (long running controller action anti pattern). let stop mvc controller action call worker queue , tell stop wo

c# - Handling multiple exceptions in a loop -

in code, method being called repeatedly within loop so: foreach (var file in files) { somemethod(file); } the method throw exceptions, don't want code exit loop after first exception. furthermore, code above being called web api controller, need way pass exception information controller, handled (log exception , return error response client). what i've done far catch , store exception in list. var errors = new list<exception>(); foreach (var file in files) { try { somemethod(file); } catch(exception ex) { errors.add(ex); } } considering rethrowing errors in list not option, best approach return exception information controller? use aggregateexception . you can pass list<exception> constructor , throw that. at end of loop do: aggregateexception aggregateex = new aggregateexception(errors); throw aggregateex; (or return aggregateexception )

bash - Encrypted HLS works as live stream, doesn't work as VOD -

i've found crude bash script encoding , encrypting video file, hls stream, , i've edited (i have no idea bash): #!/bin/bash set -e # exit on errors tsfile="$1" if ! [ -f "$tsfile" -a -r "$tsfile" ]; echo "first argument required" >&2 exit 2 fi if [ -z "$3" ]; output="output" else output="$3" fi keyfile="$output.key" keyinfofile="$output.keyinfo" playlist="$output.m3u8" if [ -z "$4" ]; separator='-' else separator="$4" fi splitfileprefix="$output$separator" if [ -d "$2" ]; outdir="$2" else mkdir "$2" || exit 1 outdir="$2" fi tempdir="$outdir/.$$_tmp" keyfile="$outdir/$keyfile" mkdir $tempdir echo "$outdir/$keyfile\n$outdir/$keyfile" > "$outdir/$keyinfofile" ffmpeg -i "$tsfile" -hls_ti

html - Javascript code for remove image -

i want make javascript code when click "remove image" link , remove image. please me. <script> function previewfile(){ var preview = document.queryselector('img'); var file = document.queryselector('input[type=file]').files[0]; var reader = new filereader(); reader.onloadend = function () { preview.src = reader.result; } if (file) { reader.readasdataurl(file); } else { preview.src = ""; } } previewfile(); </script> <input type="file" onchange="previewfile()"><br> <img src="" height="200" alt="image preview..."> <a href="#">remove image </a> </body> </html> <img id='image' src="" height="200" alt="image preview..."> <a id='remove' href="#">remove image </a> <script> $(function

stata - Plotting log odds against mid-point of category -

i have binary outcome variable (disease) , continuous independent variable (age). there's cluster variable clustvar. logistic regression assumes log odds linear respect continuous variable. visualize this, can categorize age (for example, 0 <5, 5 <15, 15 <30, 30 <50 , 50+) , plot log odds against category number using: logistic disease i.agecat, vce(cluster clustvar) margins agecat, predict(xb) marginsplot however, since categories not equal width, better plot log odds against mid-point of categories. there way can manually define values plotted on x-axis marginsplot should 2.5, 10, 22.5, 40 , (slightly arbitrarily) 60, , have points spaced appropriately? if interested, achieved required graph follows: recategorised age variable differently using (integer) labels represent mid-point of category: gen agecat = . replace agecat = 3 if age<6 replace agecat = 11 if age>=6 & age<16 replace agecat = 23 if age>=16 & age<30 replac

javascript - Handling bad JSON.parse() in node safely -

using node/express - want json out of request headers, want safely. if reason it's not valid json, it's fine, can return false or whatever , reject request , keep going. problem throws syntax error if it's not valid json. want syntax error blow up, not in case. var boom = json.parse(req.headers.myheader); do scrape stack , check bad parse call particular module, , if it's case, ignores it? seems bit crazy. surely there's better way. edit: aware try/catch blocks a way of handling error, best way in node app? way block node? the best way catch invalid json parsing errors put calls json.parse() try/catch block. you not have other option - built-in implementation throws exception on invalid json data , way prevent exception halting application catch it. using 3rd party library not avoid - must try/catch on json.parse() call somewhere. the alternative implement own json parsing algorithm more forgiving on invalid data structures, feels