Posts

Showing posts from June, 2012

java - Eclipse RCP change Task-Icon of Splash-Screen -

i have splash screen in eclipse rcp project. while application loading (and splash-screen shown) there eclipse-icon shown in taskbar. possible change taskicon? in .product file, should configure launcher information (launcher name , icons). once have defined, icons should bound launcher , icons should displayed in windows taskbar while splash screen being displayed.

mobile - How to create preferences in Android? -

i have problem android settings. want create settings changing background color of activity. have do? i have layout: public class myapp extends preferenceactivity{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } public void display(view view) { intent intent = new intent(this, display.class); startactivity(intent); } @override public boolean oncreateoptionsmenu(menu menu) { menuinflater menuinflater = getmenuinflater(); menuinflater.inflate(r.menu.menu, menu); return true; } public boolean onoptionsitemselected( menuitem item) { switch (item.getitemid()) { case r.id.menu_about: intent menu_about = new intent(this, about.class); startactivity(menu_about); return true; case r.id.menu_copyright: intent menu_copyright = new intent(this, copyright.class); startactivity(menu_copyright); return true; case r.id.menu_setting

android - Unable to display all the buttons in TableLayout -

Image
i generating buttons onto screen programatically code tablelayout mainlayout = new tablelayout(this); mainlayout.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.wrap_content, tablerow.layoutparams.match_parent)); //mainlayout.setstretchallcolumns(true); ( int =0 ; < gridsize ; i++){ rowarr[i] = new tablerow(this); for(int j = 0; j < gridsize ; j++){ button button = new button(this); button.settext(integer.tostring(i)+","+integer.tostring(j)); button.settextsize(150/gridsize); button.setmaxheight(450/gridsize); button.setmaxwidth(600/gridsize); rowarr[i].addview(button); } mainlayout.addview(rowarr[i]); } by seeing image can entire column of buttons missing. only after setting gridsize 6 or more problem occur. i able see 6th row on emulator.i guess phone width issue

asp.net mvc 4 - Using form Authentication and Basic Authentication Authorization in Web Api -

i have built mobile app using asp.net web api. authentication done using basic http authorization filter.now client want app manage mvc web application. added authorization web application using form authentication , membership provider allow me log in. but problem when made ajax call web api function decorated basic authentication authentication through web application. web application still ask me put password when log in. please want know if there way authorization can done @ once when use form authentication [authorize] on page. appreciated. i have written here: http://leastprivilege.com/2012/10/24/extensions-to-the-web-apimvc-formsbasic-auth-sample-claims-transformation-and-ajax/ also make sure read previous post well.

google bigquery - identify group by vs group each in advance -

is there way figure out in advance (not trial , error) whether specific query should use group or group each by? saw after cardinality of ~60-70% asked use group each by. hard predict generate sql. the usage of 'each' doesn't depend on query, on data. there small number of unique values group expression? use group by. there lot? use group each by. the best strategy use group until "over limits error". to go deeper "why?", can @ dremel paper started all. group runs in mixers, while group each gets pushed shards. for other insights, check jcondit's answers @ resources exceeded during query execution .

Grabbing values of jquery generated html with c# -

Image
i trying grab values of textboxs generate using jquery. textboxes added page 3 @ time. each 3 boxes represent item. add creates 3 boxes size, price , color. seems can grab in form told request.form gives namevaluecollection somehow , please correct me if wrong values should stored in collection. cant seem understand. based on collection how find names of textboxes , there values? jquery creates boxes: <script type="text/javascript"> counter = 1; function foo() { $(".form").append('<div id=item' + counter + '><hr/><div class="inneritem"><p>size</p><input type="text" name="item" /><p>color</p><input type="text" name="item" /><p>price</p><input type="text" name="item" /></div>'); del = $("#item" + counter); del.append(&

How do I fix an encog "kernel launch failure" error when running: "./encog benchmark /gpu:1" -

as part of encog install testing, tried running ./encog benchmark /gpu:0 , worked fine, when tried ./encog benchmark /gpu:1 , got: encog-core/cuda_eval.cu(286) : getlastcudaerror() cuda error : kernel launch failure : (13) invalid device symbol. i on ubuntu 11.10, got source code https://github.com/encog/encog-c , , "make arch=64 cuda=1" went without error. thanks in solving problem. here's console list benchmark worked fine: rick@rick-cuda:~/a01-neuralnet-encog/encog-c-master$ ./encog benchmark /gpu:0 * * encog c/c++ (64 bit, cuda) command line v1.0 * * copyright 2012 heaton research, released under apache license build date: may 4 2013 07:24:00 processor/core count: 32 basic data type: double (64 bits) gpu: disabled input count: 10 ideal count: 1 records: 10000 iterations: 100 performing benchmark...please wait benchmark time(seconds): 3.2856 benchmark time includes training time. encog finished. run time 00:00:03.2904 ================================

c# - Visual Studio VSPackage / Single File Generator - Log Message to Error List -

i'm working on creating visual studio vspackage containing single file generator ( ivssinglefilegenerator ) , want able log events visual studio error list ( http://msdn.microsoft.com/en-us/library/33df3b7a(v=vs.110).aspx ) i using example base classes microsoft visual studio sdk ( http://code.msdn.microsoft.com/windowsdesktop/single-file-generator-94d856d4 ). these classes have methods: public class basecodegenerator : ivssinglefilegenerator { void generatorerror(uint level, string message, uint line, uint column); void generatorwarning(uint level, string message, uint line, uint column); } this lets me make errors , warnings, not messages. methods call ivsgeneratorprogress.generateerror ( http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsgeneratorprogress.generatorerror(v=vs.90).aspx ). method doesn't seem let me wire 'message'. i have tried trying find reference error list window in visual studio write directly it,

Script SQL Server Database without partitions -

i've got sql server 2008 r2 database has several tables have been partitioned. need new, empty version of database, without partitions. know can generate script create new database objects, includes partitions well. there way generate script omit partitioning?

Subclasses of generic types in Java -

when have example interface drivable , class car implements interface. if make class generic type garage<t extends drivable> , possible make new garage<car> or inheritance not work generic types , should garage<drivable> ? the answer depends on types of drivable want put garage ' if want able put type of drivable garage , declare garage<drivable> . if ever want particular instance contain car instances it's acceptable declare garage<car> .

sql - Flattening a hierarchial data set in Oracle -

i have set of data shown below treename date level parentnode childnode grn_kk 9/1/2012 1 null allaccount grn_kk 9/1/2012 2 allaccount 52000 grn_kk 9/1/2012 2 allaccount 59900 grn_kk 9/1/2012 3 52000 54311 grn_kk 9/1/2012 3 52000 50100 grn_kk 9/1/2012 3 52000 54345 grn_kk 9/1/2012 3 52000 54346 grn_kk 9/1/2012 3 52000 54347 grn_kk 9/1/2012 4 50100 50151 i need flatten data below: grn_kk 9/2/2012 allaccount 52000 grn_kk 9/2/2012 allaccount 52000 54311 grn_kk 9/2/2012 allaccount 52000 50100 grn_kk 9/2/2012 allaccount 52000 50100 50151 grn_kk 9/2/2012 allaccount 59900 and on. i can have 30 parent child relationship i used connect , sys_connect_by_path follows select a.tree_name,a.effdt,a.parent_node_name,a.

Programmatically add a WSO2 API manager store user (subscriber) -

is possible programmatically add store user? i found following api manager service urls; https://localhost:8243/services/remoteuserstoremanagerservice?wsdl https://localhost:8243/services/apiauthenticationservice?wsdl https://localhost:8243/services/apikeymgtsubscriberservice?wsdl https://localhost:8243/services/restapiadmin?wsdl but white screen. following directories empty: /opt/wso2am-1.3.1/repository/deployment/server/jaggeryapps/store/apis/xml /opt/wso2am-1.3.1/repository/deployment/server/jaggeryapps/store/apis/rest /opt/wso2am-1.3.1/repository/deployment/server/jaggeryapps/store/apis/json seems not implemented yet. i'll appreciate update on this. please see below comment answer given similar question yours. https://wso2.org/jira/browse/apimanager-1311?focusedcommentid=66003&page=com.atlassian.jira.plugin.system.issuetabpanels%3acomment-tabpanel#action_66003 regards

c# - Difference between returning a Stream and writing to HTTP output stream -

what difference when returning files between public stream getfile(string filename){ stream s = _getfilestream(filename); response.addheader( "content-disposition", "attachment;filename=" + filename+ ";" ); return s; } and public void getfile(string filename){ byte[] b = _getfilebytes(filename); response.addheader( "content-disposition", "attachment;filename=" + filename+ ";" ); response.binarywrite(b) } and method provided in question here . the problem i'm encountering parts of image user has uploaded appear scrambled. what's odd cannot reproduce problem locally - when application on www. my thinking perhaps since resources local wouldn't see problem when streaming data , way streaming content client isn't correct. "correct" (or recommended) way of returning file? i resolved issue 2 changes. i took carlosfiguera said , changed httpcontext.current

javascript - Sorting multiple columns when I click a column header -

i'm using tablesorter 2.8.1 (mottie's fork), , have html table similar following: header1 header2 -------- --------- 5 c 1 b 4 1 when click header2, table gets sorted column: header1 header2 -------- --------- c 1 1 b 4 5 i know can sort both columns simultaneously holding down shift key , clicking header2 , header1, need having both columns sorted when click header2. in other words, need happen when click header2: header1 header2 -------- --------- 1 c 1 b 4 5 is there anyway can achieve this? thanks in advance!

Android EditText on longPress: ArrayIndexOutOfBoundsException: length=15; index=491 -

i have strange behavior cannot explain. layout quite simple: edittext: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:padding="10dp" > <edittext android:id="@+id/etpass" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout> when try longpress (to paste text) got imediate force close , error: 05-08 16:56:16.838: e/androidruntime(12164): fatal exception: main 05-08 16:56:16.838: e/androidruntime(12164): android.view.inflateexception: binary xml file line #17: error inflating class <unknown> 05-08 16:56:16.838: e/androidruntime(12164): @

javascript - Force users to re-login after session clears in Windows Authentication - ASP.Net -

the requirements are: after session clears, send user homepage, , force them re-login using windows authentication prompt. current situation: i have javascript countdown timer when hits 0, sends alert saying session over. want able either through javascript or postback server, clear user's credentials what i've read/tried: ajax post server setting httpcontext.response, , throwing httpexception(401) [httppost] public actionresult forcerelogin() { //httpcontext.response.statuscode = 401; //httpcontext.response.end(); //return redirecttoaction("index", "home"); //throw new httpexception(401, ""); return new httpstatuscoderesult(httpstatuscode.unauthorized); } neither of these seem work ajax, , i'm unsure of how cause regular post controller action doesn't involve submit. question: how force users re-authenticate windows authentication credentials, without using activ

.net - C# Asynchronous Pluggable Protocol wrapping default HTTP Protocol throws InvalidCastException -

in order able filter urls fetched (including js, images, etc.) c# web browser (winforms), containable option seems asynchronous pluggable protocol wrapping http (and later on others well). unfortunately fails invalidcastexception thrown original original protocol implementation after several calls <- weird part, seems succeed several times before failing. now code: firstly factory protocol registered , attached: var ep = new filteredhttpprotocolfactory(); guid id = guid.parse ("e00957bd-d0e1-4eb9-a025-7743fdc8b27b"); session.registernamespace (ep, ref id, "http", 0, null, 0); (the factory:) [guid ("ef474615-8079-4cfa-b114-6d1d28634dd8")] [comvisible (true)] [classinterface (classinterfacetype.none)] public class filteredhttpprotocolfactory : iclassfactory { public void createinstance (object punkouter, guid riid, out object ppvobject) { ppvobject = new filteredhttpprotocol(); } public void lockserver (bool flock) {

css - How to write this styling in latest implementation of CSS3's Flexbox -

i figured out how achieve style 2009 implementation of flexbox, there 2 other implementations. short-lived 2011 , part of 2012 syntax , current , final syntax. how can write code in current , final implementation? if can 2011 implementation, great! i'm looking vendor-prefixes. display:-moz-box; display:-webkit-box; display:box; -moz-box-align:center; -webkit-box-align:center; box-align:center; -moz-box-orient:horizontal; -webkit-box-orient:horizontal; box-orient:horizontal; -moz-box-pack:center; -webkit-box-pack:center; box-pack:center; the complete set of properties this: .foo { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-box-pack: center; -moz-box-pack: center; -ms-flex-pack: center; -webkit-justify-content: center; justify-content: center; -webkit-box-align: center; -moz-box-align: center; -ms-flex-line-pack: center; -webkit-align-content: center; align-content

Can a website be made in cocos2d-html? -

i have been working cocos2d-iphone, cocos2d-x, , cocos2d-html5 quite time. wanted ask if okay build website cocos2d-html5. want because want website interactive, animated, , scroll around game. can javascript, possible write in cocos3d-html5? drawbacks of doing this? , there existing website built on cocos2d? thank help. as figured out, cannot make cocos2d-html based website making web apps web sites. although web app can cover whole screen there large number of issues assigned creating such situation. internet users used using refresh , buttons on web browser opening in new tab, nothing of these options work in cocos2d-html based web app navigation done within application , in no way can button in browser respond in appropriate manner.

javascript - Clone <tr> from a form and append to another form - but losing links(events) -

i modifying third party built web client messaging api increase number of servers can search on chat rooms. api built search on 1 server node. server response in form of form (without methods fields from) , publishes browser via callback. the result list of search rooms, when selected trigger , event , lets user join chat room. i have modified code throws search request multiple times, , gets multiple response forms displays multiple div's. i have cloned /.clone(true)/ rows , appended them last form, displaying (thanks other posts here:) user able select list last form response, , other list appear texts. is there way clone links well? new web programming , thinking links active when in instance, (which when form received - , instance replaced when form received) cannot sure of this. this function wherein last form received , saved rows appended. _01handleconfigsubmit: function (form, error) { if (form) { var formview = new jabberwerx.

javascript - Jquery - Get previous value row in table -

Image
i have dynamic simple table like: i try previous value cell when click edit button. example: when click first edit button alert('a1') when click second edit button alert('a2') i try $('.edit').click(function(){ alert($(this).parents('tr').prev().children().eq(1).text()); }); it's working first edit button because previous row has 1 row. , it't not working second edit button. how can (by dynamic previous row) http://jsfiddle.net/bwjbj/ ps: i'm working next row alert($(this).parents('tr').nextall(':eq(' + ($(this).parent().siblings().eq(0).attr("rowspan")-1) + ')').children().eq(1).text()); http://jsfiddle.net/mblase75/xgdkd/ the problem second edit button, previous table row isn't row want -- want row 2 more before that, because that's rowspans begin. or, general: want the table row belonging previous edit button. in case of first edit button, though, want pre

has one - Rails has_one with join table -

in app there athletes ... athletes can have many sports. athlete: has_many :sports, :through => :user_sports has_one :primary_sport, conditions: ["user_sports.primary = ?", true], class_name: "sport" has_many :user_sports usersport: class usersport < activerecord::base attr_accessible :athlete_id, :sport_id, :primary belongs_to :athlete belongs_to :sport end i trying able pull primary_sport sport object instead of user_sport object. since pull sports objects :through user_sports, should pull primary_sport object :through user_sports well. has_one :primary_sport, :through => :user_sports, conditions: ["user_sports.primary = ?", true], class_name: "sport"

benchmarking - Changing the file descriptor size in httperf -

i'm doing series of benchmarks , found httpperf tool. but version in ubuntu 12.04 has small file descriptor size. because warns me message: httperf: warning: open file limit > fd_setsize; limiting max. # of open files fd_setsize there used guide compile httperf bigger size in http://gom-jabbar.org/articles/2009/02/04/httperf-and-file-descriptors site down now. does knows steps compile tool proper settings? i've followed instructions here , should set global values properly. can check issuing ulimit -n (n.b. had include ulimit -n 65535 in .profile — reason named users don't require root does.) don't forget recompile httperf. before doing make install issue ./httperf -v | grep maximum — should see 65535. if not, went wrong. i working on similar project (httperf 0.9.0 on ubuntu 12.04) having difficulty getting httperf compile properly. i'm sure i've forgotten basic, let me know how fare. edit: realized problem library ver

Reading App.config to get the value based on key in c# library project -

i trying read setting app.config , looks below <?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="chrome" value="path chrome driver" /> <add key="ie32" value="path ie32 driver" /> <add key="ie64" value="path ie64 driver" /> <add key="url" value="url site"/> </appsettings> </configuration> i using following code read content using system; using system.configuration; public static class config { public static string clientid { { return configurationmanager.appsettings["ie32"]; } } } why return null? how many projects have? i suspect have 2 projects (or more) app.config needs in project being run not project config class. also when build project if console app or windows app bin

android - galaxy s4 and maybe all HD phones? out of memory error inflating layout -

so app working on, works fine on old miserable android 2.3.3 phone. when running on gs4, gs4 throwing out of memory exceptions every time has load resource drawables, predefined in xml. <imageview android:id="@+id/ivlearnmore" android:layout_width="match_parent" android:layout_height="200dp" android:layout_weight="1" android:scaletype="fitcenter" android:src="@drawable/learn_more" /> for example imageview throw exception when inflating layout because has image assigned. (256x256) what going on? 05-08 10:33:54.972: e/dalvikvm-heap(24423): out of memory on 16777232-byte allocation. 05-08 10:33:54.972: i/dalvikvm(24423): "main" prio=5 tid=1 runnable 05-08 10:33:54.972: i/dalvikvm(24423): | group="main" scount=0 dscount=0 obj=0x41187b38 self=0x40dd1b68 05-08 10:33:54.972: i/dalvikvm(24423): | systid=24423 nice=0 sched=0/0 cgrp=apps handle=107

java - What is the most passive way to create a timer loop? -

for of need know, i'm writing plugin craftbukkit, modded version of minecraft, , i'm beginner level java programmer. have think basic question. i'm trying implement countdown executes methods send messages players every second 20 seconds. obviously, can't create loop loops 20 seconds, because loop freeze main thread until finishes, unacceptable. (there lot of game code executing) what approaches creating loop run passively or without halting main thread? the thing can possibly think creating new thread run countdown in. surely there simpler way this? so aren't confused, countdown isn't initialized part of main loop, initialized linearly user command listener, code executes in main loop. mean need start loop checks time, because code executed once. sorry if i'm not being clear or making sense. i recommend java.util.timer if not using swing gui/graphics (not familiar craftbukkit, determine). in particular, @ forms of schedule allow

c++ - The easiest way to draw strings in QGLWidget -

i'm creating qglwidget subclass initializegl . resizegl , paintg l. fine, can draw 2d graphivcs gluortho2d , 3d too. fine. now need draw text, no text rotation, no text deformations, no particular fonts. first trial glut engine program kept on crashing thought qglwidget glut not work in context. i've tried qpainter , remember use end() method , swapbuffers too, but.. nothing, text rendered opengl stuff no.. what easiest way draw text on qglwidget? i first rendering text qimage contents copy texture using gltexsubimage2d . draw textured quad. code actual project void displaytext(qstring const &text, bool render_text) { if(!text_texture) { glgentextures(1, &text_texture); } glactivetexture(gl_texture0); gltprintmultierror("glactivetexture"); glbindtexture(gl_texture_2d, text_texture); gltprintmultierror("glbindtexture"); int tex_width, tex_height; glgettexlevelparameteriv(gl_texture_2d, 0, g

c# - Efficient way to count number of pages to print? -

tldr how can 1 efficiently determine amount of pages have printed? ** note: marked klugerama's answer answer question. i'm still open other suggestions though! currently, have application in production prints invoices. printing isn't problem: customer information, invoice details etc printed should be. however, users complaining time takes software send print job printer. at moment, have implemented rather inefficient way print. in order know how many pages have print, 'dry run' of print job , cancel before gets sent printer. count number of pages print job contains , add information print job sent printer. this, 'abuse' printdocument.printpage method. after doing so, can print "page 1/2 - page 2/2" etc. i'm thinking handling in different way. know margins have in page, header , footer. ergo, space between header , footer available space print article information (name, price etc). if calculate height of string (using graphics.mea

c# - CAS Server .Net Client integration with asp.net web application Single Sign Out -

i setup cas server single sign asp.net web application , apache tomcat 7. follow below link create configuration. https://wiki.jasig.org/display/casum/howto+casifying+asp.net+webapp+-+examplewebsite my problem ssl enable not working(import iis .net ssl certificate jvm). when browse cas server https://localhost:443/cas/index.jsp . gives following error. the webpage @ https://localhost:8443/cas/index.jsp might temporarily down or may have moved permanently new web address. error 113 (net::err_ssl_version_or_cipher_mismatch): unknown error. i able solve problem using following details. please follow each , every step given in following links. first install tomcat https://wiki.jasig.org/display/casum/best+practice+-+setting+up+cas+locally+using+the+maven2+war+overlay+method second ssl certification https://wiki.jasig.org/display/casum/howto+casifying+asp.net+webapp+-+examplewebsite if has problems, please feel free contact me.

Android UI Images vs Layout xml -

i wondering thoughts on better strategy when designing ui android devices. which preffer: setting size of elements in xml files, each denisty (and size when needed), using 1 set of images (xxhdpi images) scale down when needed. pros - smaller apps (less resources) less work on images ui people. cons - more work on xml files (a whole lot sometimes) create images each denisty (and size if neede) using wrap_content of time. pros - 1 set of xml layout files. cons - more images , larger sized apk. more work on images ui people. what other approaches using? thanks! i think misunderstanding android doing when scales images not provide. android docs state: by default, android scales bitmap drawables (.png, .jpg, , .gif files) , nine-patch drawables (.9.png files) render @ appropriate physical size on each device. example, if application provides bitmap drawables baseline, medium screen density (mdpi), system scales them