Posts

Showing posts from March, 2012

system.drawing - how to draw in asp.net(c#)? -

Image
how draw next image labels in rectangles? help: use different classes in system.drawing namespace. alternatively, use 1 of many drawing libraries around. note: the documentation on msdn gives following warning: classes within system.drawing namespace not supported use within windows or asp.net service. attempting use these classes within 1 of these application types may produce unexpected problems, such diminished service performance , run-time exceptions. supported alternative, see windows imaging components. however, , others have done so have not found problems. msdn magazine suggests it...

Handling errors and continuing execution in PHP script -

i don't want "die()" when concerns small part of script , tried: $result = mysql_query($sql) or echo("error responses"); but generated error. how give out error message , continue execute rest of script since if fails connect, rest should not affected. $result = mysql_query($sql); if(mysql_error()) { echo "error: " . mysql_error(); }

java - Why isn't my if-else block ever getting hit, even though it should be? (Just need another pair of eyes.) -

i making falling sand style game in java, , i'm having weird issues if-else block have. in dogravity() method, have various blocks of conditions cause different things happen, , odd reason, 1 block never getting hit. when have block count how many times each condition hit, left , right blocks hit evenly: else if(world[x][y+1]==empty && (x-1 >= 0) && world[x-1][y+1] == empty && (x+1 < world.length) && world[x+1][y+1]==empty) { int r = rand.nextint(50); if(r == 0) { world[x-1][y+1] = world[x][y]; //system.out.println("go: right"); countright++; } else if(r == 1) { world[x+1][y+1] = world[x][y]; //system.out.println("go: left"); countleft++; } else { world[x][y+1] = world[x][y]; countcenter++; } world[x][y] = empty; } next comes condition, equally distributes left , right. else if((x-1 >= 0) && world[x-1][y+1]

jQuery - datepicker.parseDate on 'mm/y' causing Invalid Date -

i have validate method seems pretty simple because use similar when using format mm/dd/yy , when use mm/y ...i keep getting invalid date. here validation: function validatedate(datefield) { try{ $.datepicker.parsedate('mm/y', datefield, null); } catch(error){ alert(error); } } if pass in date 05/11 ...this logic complains date invalid. if change format mm/dd/yy , enter 05/11/2011 ...then says valid. am missing when trying validate mm/y pattern? unfortunately, need supply @ least month , day datepicker parse date properly. if leave year out, defaults current year, parsing "06/15" "dd/mm" give 2011-06-15. if either month or day omitted, default -1 , produce invalid date. edit: if trying confirm user entered valid month , year, this: $.datepicker.parsedate('dd/mm/y', "01/" + datefield, null);

javascript - jQuery UI Overlay Repeat Fix For "Auto" Dimensions -

a while ago, had problem pop-up dialogs had height going beyond background. translucent overlay stopped in middle , underneath black. friend fixed me. said: "for dialog issue used 900px width , height. there's no way accomplish fix purely css because values overwritten when javascript called display dialog. need after opening/creating dialog resize background overlay dimensions of page. can see in index.html bonus features." unfortunately, fix doesn't apply when width , height set 'auto'. can please me here? thanks. $("<div class='popupdialog'>loading...</div>") .dialog({ autoopen: true, closeonescape: true, width: '900', height: '900', modal: true, title: 'bonus features', beforeclose: function(){ $(this).remove(); } }).load(url, function() { $(this).dialog("option&

python - gtk.gdk.color_parse() equivalent in vala -

i'm trying find equivalent pygtk function gtk.gdk.color_parse in vala. can find gdk.color.parse sort of similar, returns boolean instead of gdk.color structure. seems should able find equivalent python function, don't seem able to. no, that's 1 - gives color "out parameter" instead of return value. python doesn't have out parameters (well, python has feature if try hard enough...) boolean return value tells whether parsing succeeded. pygtk raises exception if doesn't. use this: gdk.color fuchsia; if (!gdk.color.parse("fuchsia", out fuchsia)) print("there error parsing, must have spelled fuchsia wrong");

tdd - Should BDD be automated with unit tests, integration tests, or both? -

bdd has been touted "tdd done right". however tdd used unit tests, rather end-to-end integration tests. which kind of test appropriate bdd? should write integration tests? should write unit tests? if yes, should there multiple unit-tests per scenario? and unit test covers multiple scenarios? there way structure these tests when using testing framework such mspec? which kind of test (integration tests, unit tests) appropriate bdd? i use both in 2 nested loops described in behavior-driven development specflow , watin * writing failing integration tests * writing failing unit test part of solution of integration test * making unittest pass * refactor * writing next failing unit test part of integration test * unitl integration test passes * writing next failing integration tests

php - Trying to output the number of rows in sql to jquery -

i have followed tutorial add comments asynchronously page. makes sense, want change display count of number of comments in mysql table. have attempted changing logically seem lost how pass data php jquery function properly? here original working comments code: javascript <script type="text/javascript"> $(function() { //retrieve comments display on page $.getjson("comments.php?jsoncallback=?", function(data) { //loop through items in json array (var x = 0; x < data.length; x++) { //create container each comment var div = $("<div>").addclass("row").appendto("#comments"); //add author name , comment container $("<label>").text(data[x].name).appendto(div); $("<div>").addclass("comment").text(data[x].comment).appendto(div); } }); }); </script> and comments.php <?php //db connection det

entity framework: join on the rule "A = substring(B)"? -

could ask show me way how declare association between 2 entities 'record' , 'dictionaryitem' if corresponded tables on db level joined such interesting rule: records r left outer join dictionaryitems d on substring(r.compositekey,3,8) = d.dictionaryitemid p.s. i'm working poco entities. linq-to-entities doesn't support substring . must either execute sql directly calling context.database.sqlquery<> or must use entity sql - require converting dbcontext objectcontext via iobjectcontextadapter , creating objectset , running esql query.

Android: Http post with parameters not working -

i need create http post request parameters. know there many examples out there, have tried using httpparams, namevaluepair etc cant seem correct format server. server type: rest based api utilizing json data transfer content-type: application/json accept: application/json content-length: 47 {"username":"abcd","password":"1234"} i can pass these headers cant seem pass these params "username","password". here code: httpclient client = new defaulthttpclient(); httppost post = new httppost("http://www.mymi5.net/api/auth/login"); list<namevaluepair> pairs = new arraylist<namevaluepair>(); pairs.add(new basicnamevaluepair("username","abcd")); pairs.add(new basicnamevaluepair("password","1234")); post.setheader("content-type", "application/json"); post.setheader("accept", "application

ajax - JavaScript to get user input from editable table cell and send to server via json -

i created table 5 columns dynamically. 2 (the second , third column) of 5 columns should editable on fly. each time when user click on 1 editable table cell, javascript should catch user input , send data server in json format. have problem catch user input , send server. please help. sample code - <!doctype html> <html> <head> <title>editable table</title> <style type="text/css" title="currentstyle"> @import "css/table.css"; </style> <script type="text/javascript" language="javascript" src="js/jquery.js"></script> </head> <body id="dt_example"> <div id="container"> <div class="full_width big"> data table<br /> </div> <div class="editab"> <table border="1"> <

c# - Fading out a window -

i developing wpf c# application. have added event triggers xaml of form fade in when window loads , fades out when window closes. the fading in works without problems fading out not working. i have set window fades in when loads, has timer last 5 seconds, , calls form fade out event. however, window doesn't fade out closes straight away no animation. below code have fade in , fade out events <window.triggers> <eventtrigger routedevent="window.loaded"> <beginstoryboard> <storyboard name="formfade"> <doubleanimation name="formfadeanimation" storyboard.targetproperty="(window.opacity)" from="0.0" to="1.0" duration="0:0:1" autoreverse="false" repeatbehavior="1x" /> </stor

radio button - reserving a place for a radiobutton created dynamically in asp.net? -

i creating radiobuttons positioned horizontally, showing , not showing others depending on condition if set visible false, place occupied next radio button, there way of put space instead? basic creation of radiobutton: (test code) dim rdbutton new radiobutton rdbutton.text = "test" rdbutton.groupname = "test2" cell.controls.add(rdbutton) dim rdbutton2 new radiobutton rdbutton2.text = "test2" rdbutton2.groupname = "test2" rdbutton2.visible=false cell.controls.add(rdbutton2) dim rdbutton3 new radiobutton rdbutton3.text = "test" rdbutton3.groupname = "test2" cell.controls.add(rdbutton3) thanks you use css class hide radio button. achieve can similar

Android mkdir not making folder -

tonight having issues doing thought simple... making folder in /mnt/sdcard. i have set follow permission: <uses-permission android:name="android.permission.write_external_storage"></uses-permission> my main.java has following make folder: public class main extends tabactivity { static int index = 1; private static final string tag = "main"; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); file folder = new file(environment.getexternalstoragedirectory () + "/tallgrass/images"); boolean success = false; if(!folder.exists()){ success = folder.mkdir(); } if (!success){ log.d(tag,"folder not created."); } else{ log.d(tag,"folder created!"); } } i "folder created!" message in log when check both /mnt

ruby on rails - No Route error when passing parameters through link_to -

error: no route matches {:action=>"new", :controller=>"comments", :parent_id=>1} routes.rb: myapp::application.routes.draw resources :posts resources :comments end resources :topics resources :posts end root :to => "posts#index" end models: class topic < activerecord::base has_many :posts, :dependent => :destroy attr_accessible :name, :post_id end class post < activerecord::base belongs_to :topic, :touch => true has_many :comments, :dependent => :destroy accepts_nested_attributes_for :topic attr_accessible :name, :title, :content, :topic, :topic_attributes end class comment < activerecord::base has_ancestry attr_accessible :name, :content belongs_to :post, :touch => true end view: <%= link_to "reply", new_post_comment_path(@post, :parent_id => comment.id) %> controller: class commentscontroller < applicationcontroller respo

utf 8 - Why use MultiByteToWideChar and WideCharToMultiByte at the same time? -

i saw code this: why use multibytetowidechar , widechartomultibyte @ same time? char szline[max_length_string] = {0} ... //some operate szline char *szutf8string; wchar_t *szunicodestring; int size; int room; size = strlen(szline)+1; room = multibytetowidechar(cp_acp, 0, szline, -1, null, 0); szunicodestring = (wchar_t*) malloc((sizeof(wchar_t))*room); multibytetowidechar(cp_acp, 0, szline, -1, szunicodestring, room); room = widechartomultibyte(cp_utf8, 0, szunicodestring, -1, null, 0, null, null); szutf8string = (char*) malloc(room); widechartomultibyte(cp_utf8, 0, szunicodestring, -1, szutf8string, room, null, null); this code fragment first converts string multibyte representation using system default code page unicode, converts utf-8 multibyte representation. thus, converts text in default code page utf-8 representation. the code fragile, in assumes utf-8 version double in size (this works of time, worse case single byte in default code page may map 4 bytes in utf

python - print values in pdb -

this first time use pdb debugger in python. please pardon me if dumb question. when trace function, inside function print values of variable names underscore in beginning, eg. p __seqlen . keeps showing attributeerror: attributeerror("converter instance has no attribute '__seqlen'",) tried use p self.__seqlen . not working well. may ask how can print values? in advanced. p locals() p globals() could help.

C++ program written in Eclipse using Windows and MinGW cannot display output to console view -

i'm using windows 7 64bit. i installed eclipse version 3.6.2, cdt, , mingw. have c++ console program in eclipse follows: #include <iostream> #include <cstdio> using namespace std; int main() { setbuf(stdout, null); (int = 0; < 10000000; i++) { cout << "!!!hello world!!!" << endl; // prints !!!hello world!!! } int val; cin >> val; return 0; } if run console program, should display hello world console view in eclipse, nothing displays. if go debug folder , run exe, print console. if make syntax mistake, eclipse console view show something, such as: **** internal builder used build **** g++ -o0 -g3 -wall -c -fmessage-length=0 -osrc\hh.o ..\src\hh.cpp ..\src\hh.cpp: in function 'int main()': ..\src\hh.cpp:17:3: error: expected ';' before 'return' build error occurred, build stopped time consumed: 255 ms. why nothing showing in eclipse console view , how can make c

Remote Lazy Loading in Hibernate -

normally web applications having access hibernate session use lazy loading fetch parent entity multiple child entities. in case of distributed application presentation layer doesn't have access hibernate session, how lazy loading happen (remotely)? how lazy loading happen (remotely)? it won't, hibernate not support out-of-the-box (for reason, see this instance). your option eagerly fetch want (which considered practice anyway) or explicitly ask lazy collections on remote side (by calling "hibernate" side again).

c# - Windows service Debug Issue -

i have created windows service have try debug use under debug tab click on attach process select myservice.exe wont go through break point. in service on start event write following code protected override void onstart(string[] args) { console.writeline("press enter terminate ..."); } please me how resolve issue.... use following method.on code. far easiest method set breakpoint on service library. debugger.break(); protected override void onstart(string[] args) { debugger.break(); console.writeline("press enter terminate ..."); }

javascript - how to use date picker on dynamically generated objects -

i want use datepicker, while generating text boxes on need use date picker. can 1 tell me how can use. after creating text box dynamically use jquery make in date picker. $('#divid').append('<input type="textbox" id="txtid"/>');//create text box $('#txtid').datepicker();//create date picker

Problem finding the ratio of frequency of a word to total no of words in a text file in c -

#include<conio.h> #include<stdio.h> #include<iostream.h> #define null 0 int main() { char name[20],c; int nw=0; int j=0; int t=0; char s[] = "newas"; // find frequency of word in abc.txt char p[5]; file *fpt; //printf("enter name of file checked:- "); //gets(name); fpt=fopen("abc.txt","r"); if (fpt==null) { printf("error - can/'t open file %s",name); getch(); exit(0); } else { while ((c=getc(fpt))!=eof) { switch(1) { case 1: if (c==' ') { point: while((c=getc(fpt))==' '); if (c!=' ') nw=nw+1; // if(c==' ') // nw--; if(j < 5)

javascript - Ext JS Border layout: how to collapse a region programmatically? -

i have panel "border" layout, having "center" , "north" region. want programmatically collapse north region, , according forum way is: container.layout.north.collapse(); however, container.layout string object container.layout.north giving me null object. does have 2 seconds pointer on how handle correct layout object call collapse() upon? the cheapest way hold of panel need calling ext.getcmp() . container.layout undefined because not object of ext.component. set id border panel or panel need access to. var panel = ext.getcmp('borderpanelid'); panel.layout.north.collapse(); another way use north panel's id. in case will: var panel = ext.getcmp('northpanelid'); panel.collapse(); another way make user of ref system. set ref property panels. , if have access component's owner.. can simple use ref reference panel or other components.

Is there some kind of 'assertion' coverage tool (for Java)? -

before question marked duplicate, please read it. ;) there several questions coverage tools , such, bit different usual ones (i hope). according wikipedia there several different kind of 'coverage' variations affect several different aspects of term 'coverage'. here little example: public class dummy { public int = 0; public int b = 0; public int c = 0; public void dosomething() { += 5; b += 5; c = b + 5; } } public class dummytest { @test public void testdosomething() { dummy dummy = new dummy(); dummy.dosomething(); assertequals( 10, dummy.c ); } } as can see, test have coverage of 100% lines, assertion on value of field 'c' cover field , indirectly cover field 'b', there no assertion coverage on field 'a'. means test covers 100% of code lines , assures c contains expected value , b contains correct one, not asserted @ , may wrong value. so...

python - input working in shell but not terminal -

i have: filename = input() open(filename) file: print('it opened.') saved on desktop "test.py". i run terminal, , get: blahblahblah:~ rickyd$ python /users/rickyd/desktop/test.py /users/rickyd/desktop/tryme.txt traceback (most recent call last): file "/users/rickyd/desktop/test.py", line 1, in <module> filename = input() file "<string>", line 1 /users/rickyd/desktop/tryme.txt ^ syntaxerror: invalid syntax when run in shell, works perfectly: >>> ================================ restart ================================ >>> /users/rickyd/desktop/tryme.txt opened. >>> why isn't working in terminal? is there way make sure (at least code not explicitly designed otherwise) shell , terminal give same behavior, won't have check both separately? when running in terminal, running python 2. that's why doesn't work. which os on, , how run it?

c# - How do I add this (recaptcha) form dynamically? -

i have .aspx file , want dynamically add form , controls below in <script> tag. (page-language=c#) <form runat="server"> <asp:label visible=true id="lblresult" runat="server" /> <recaptcha:recaptchacontrol id="recaptcha" runat="server" theme="red" publickey="6ld4pcqsaaaaadvexkhlgujfxixyyej0x6zqdzan" privatekey="6ld4pcqsaaaaabag0i2nk6fmjbstxqqcs2xrdoea" /> <br /> <asp:button id="btnsubmit" runat="server" text="submit" onclick="btnsubmit_click" /> </form> why want add dynamically? although, not answer question more simpler way put said markup in placeholder control , sets placeholder's visibility per requirements. and if must add controls dynamically, still need placeholder (after script tag) parent , can cr

c# - How to get reference of DropDownList into codebehind? -

<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" onrowupdating="gridview1_rowupdating" onrowediting="gridview1_rowediting"> <columns> <asp:templatefield headertext="test"> <edititemtemplate> <asp:updatepanel id="up1" runat="server" updatemode="conditional"> <contenttemplate> <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true" onselectedindexchanged="dropdownlist1_selectedindexchanged"> <asp:listitem>test1</asp:listitem> <asp:listitem>test2</asp:listitem> <asp:listitem>test3</asp:listitem> </asp:dropdownlist>

c# - Unique Property Attribute value per class -

here attribute class: [attributeusage(attributetargets.property, allowmultiple = false, inherited = true)] public class tagattribute : attribute { public tagattribute (string tag) { tag = tag; } public string tag { get; set; } } the idea create class , decorate each property tag attribute , tag value. example: property name have attribute tag("userid") one of validations need check tag value ("userid") unique per class properties. meaning no other property has tag same value ("userid") i'm pretty sure there simple way linq casting must done , i'd appreciate :) thanks in advance :) this code print duplicate tags in given assembly, , list of properties have tag: assembly asm = ... var propertiesbytag = t in asm.gettypes() p in t.getproperties() in p.getcustomattributes(typeof(tagattribute)).cast<tagattribute>() group p a.tag g select new { tag = g.key, pro

smartgwt - Exception at the time of GWT compile -

when build project gwt compiler found exception on console: myconsole: compiling module com.ems.emsweb compiling 5 permutations compiling permutation 0... compiling permutation 1... compiling permutation 2... compiling permutation 3... compiling permutation 4... compile of permutations succeeded linking d:\workspace3\emsweb\war\emsweb linking public artifacts d:\workspace3\emsweb\war emitting resource 0a9476898799a150d840f0b1c3672921.cache.png [error] fatal error emitting artifact java.io.filenotfoundexception: d:\workspace3\emsweb\war\emsweb\0a9476898799a150d840f0b1c3672921.cache.png (access denied) @ java.io.fileoutputstream.open(native method) @ java.io.fileoutputstream.<init>(fileoutputstream.java:194) @ java.io.fileoutputstream.<init>(fileoutputstream.java:145) @ com.google.gwt.dev.util.outputfilesetondirectory$1.<init>(outputfilesetondirectory.java:54) @ com.google.gwt.dev.util.out

ios4 - Iphone Tableview reaload data how to make the new data at the top rows of the tableview -

i have decler nsmutable array , load data tableview here issue new loaded data comes middle of tableview or @ bottom want comes @ top rows when reload data in tableview how possible if can me thankful him/her; it depends on way add objects in array. example: if nsmutablearray named source , if call [source addobject:@"new row"]; you'll find @"new row" last row in table, while if call [source insertobject:@"new row" atindex:0]; you'll find first row.

Hibernate ans oracle stored procedures -

i have oracle stored procedure :` create or replace procedure getclientfromauthentification(mycursorresult out sys_refcursor, login in varchar2, pwd in varchar2) num_client number(6); compte_epargne varchar2(50); compte_courant varchar2(50); nom varchar2(50); prenom varchar2(50); adresse varchar2(100); begin open mycursorresult select client.num_client, client.num_compte_epargne, client.num_compte_courant, client.nom_client, client.prenom_client, client.adresse_client client client.login_client = login , client.mdp_client = pwd; fetch mycursorresult num_client, compte_epargne, compte_courant, nom, prenom, adresse; if mycursorresult%rowcount > 1 raise too_many_rows; else if mycursorresult%rowcount = 0 raise no_data_found; end if; end if; exception when too_many_rows raise_application_error(-20000, 'base corrompue'); when no_data_found raise_application_error(-20001, 'pas de résultats'); end getclientfr

javascript - MonoTouch - Can I call ShouldStartLoad with AJAX? -

first of all, want thank miguel.de.icaza this answer! helped lot! - here's big but, here's our problem. in uiwebview start "little" javascript app, created senchatouch, displays charts. give little , feel, there's interaction graphs. , sometime, need more data backend (e.g. different chart types) using ajax request. since backend saved self signed certificate, doesn't work webview, know. so, try accieve ajax request our js-app monotouch-app code, mono-app gets data webview , passes javascript function, updates charts new data. but of right now, we're not able work, because call location.href = "app://get/chartdata" we're logging "about:blank" request, right before "app://get/chartdata" request, - of course - blanks webview , current chart gone. using simple ajax request doesn't work reason. meaning, ajax request doesn't call shouldloadstart callback. maybe, knows why? here's our monotouch code far. t

sql server 2008 - SQL table design with contigent constraints -

Image
i have table design problem need cunning solution. let's have 2 tables, relationship: contract 1---n payment now, let's have legacy data needs go these tables. problem though many of legacy payment entries aggregated across mulitple contracts so view as: new: somethingabovecontract 1---n contract 1---n payment legacy: somethingabovecontract 1---n payment now, can around creating m-n relationship between contract , payment. contract 1---n contractpayment n---1 payment (it possible me identify contracts linked aggregated payment) this fine legacy data, want enforce 1-n relationship between contract , payment going forward. so, using unhandy scribble illustrate, this: i.e. payment aggregate, contractid null, otherwise should not null. in other words, need find way enforce following contingencies on payment table: contractid nullable if paymentid appears in contractpayment contractid not nullable if paymentid not appear in contractpayment i do

Why do I receive the warning "The SDK for the 'net-2.0' framework is not available or not configured." when running a delay-sign task in NAnt? -

i'm using nant 0.85 build script. part of script complete signing process of delay-signed assemblies using delay-sign task. when script executed on build server, runs without problems. when run same script on local development machine, warning: the sdk 'net-2.0' framework not available or not configured. @ nant.core.tasks.externalprogrambase.determinefilepath() @ nant.core.tasks.externalprogrambase.get_programfilename() @ nant.core.tasks.externalprogrambase.prepareprocess(process process) @ nant.core.tasks.externalprogrambase.startprocess() @ nant.core.tasks.externalprogrambase.executetask() @ nant.dotnet.tasks.delaysigntask.executetask() @ nant.core.task.execute() @ nant.core.target.execute() @ nant.core.project.execute(string targetname, boolean forcedependencies) @ nant.core.tasks.calltask.executetask() @ nant.core.task.execute() @ nant.core.target.execute() @ nant.core.project.execute(string tar

c# - I have an API that returns items, so do i need a Service / Repository, another layer of extraction -

can me question, little confused. i have api (a dll) has various methods return objects / collections of items. i create web service return items calling client. so whats best approach, call methods directory on api , convert these dtos using automapper , return them web service? internally api uses service / repository layer. the information returned form api isn't in correct format. have adjusting or write new methods. so best idea have own service / repository layer interrogate database directory wcf service rather using api. or use api of items can , implement own service / repository items not available api. i don't want duplicating work, don't see options. maybe service / repository should shared wcf , api?? idea or comments appreciated of how tackle this. it seems quickest way implement it, while maintaining maintainable (say 3 times), use api within service. so, web service methods call api. if return caller serializable objects,

Stored Procedure not working in MySQL -

delimiter $$ drop procedure if exists `pawn`.`simpleproc`$$ create definer=`root`@`localhost` procedure `pawn`.`simpleproc`(out param1 int, inout incr int) begin declare incr integer; set incr= incr+1; select count(*) param1 pawnamount; end $$ this code create stored procedure....it's created.. execute.. call simpleproc(@param1,@incr); select @param1,@incr the result null values.. simple one.. i've tried many times.but,i null values only.. declare incr int; -- incr null here, add default 0 if want have value set incr = incr + 1 -- null + 1 still null select count(*) param1 pawnamount; -- if table pawnamount empty, generates empty set, in parameter assignment becomes null.

jquery - jqgrid - table headers label alignment problem in IE -

Image
i have problem jqgrid headers. in firefox displaying shown below... in ie7 displaying shown below... can solve problem... i used following html jqgrid < table id="list" cellpadding="0" cellspacing="0">< /table> < div id="pager" >< /div> i think known issue because i've seen it, - in ie9. if, example, have title long inside of narrower column, bumps contents of column in header row out of alignment , part of word overlap next column if "overflow" on class being ignored. as quick fix, if set column width wider text in header, not show alignment problem. know not best-case solution because if manually collapses width on column, mess alignment again. best can tell when @ css jqgrid, <div> hold text inside of <th> row has overflow compatibility issue styles applied <th> control white-space, float , text-align.

java - How to listen to press more buttons on the keyboard? -

i on keyboard lot more buttons, , need listen push buttons (multimedia play, stop ..). how it? and catch event, when window minimized. use jintellitype catch key events outside app in windows. here linux jxgrabkey update: use multimedia buttons, need know it's codes. add listener app's frame find out codes: class mykeylistener extends keyadapter { public void keypressed(keyevent evt) { system.out.println("key code: " + evt.getkeycode()); } } if know code, check if evt.getkeycode() need , make actions.

sharepoint - SPList.GetItems defaultView returning different fields than are actually present in the DefaultView of the list -

i binding splist items gridview getting datatable, getting entirely different fields in datatable fields present in defaultview of splist. not field names changed (internal names/ title) , fields different ones present in list's default view. i using following code: gridview gd = new gridview(); gd.datasource = list.getitems(list.defaultview).getdatatable(); this due list.defaultview either not being populated or correct. try setting value before call items. i.e.. spview defview = list.defaultview; gd.datasource = list.getitems(list.defaultview).getdatatable();

Matlab z buffer for simulating kinect -

we trying simulate simple kinect output. i have rendered triangle mesh in matlab , want @ depth buffer of figure/axis shape has been rendered. how do in matlab? i.e. how access depth buffer of figure? you try this .

activerecord - Rails has_many meta data -

i have model declares multiple has_many relationships. there meta data available in activerelation such can loop through these has_many relationships when working model in order see how many has_many relationships model involved in, , access contents of each there? some pseudocode (will not run) if helps clarify goal is: mymodel.has_many_relationships.each |relationship| relationship.contents.each |content| # ... end end sure can! try searching "reflect_on_all_associations" in rails documentation! reflect_on_all_associations(macro = nil) returns array of associationreflection objects associations in class. if want reflect on association type, pass in symbol (:has_many, :has_one, :belongs_to) first parameter. example: account.reflect_on_all_associations # returns array of associations account.reflect_on_all_associations(:has_many) # returns array of has_many associations

git svn - Setting up SVN repository on Remote machine with XCode 4.0 -

i have followed documentation setup svn repository existing project. followed following steps: mkdir branches mkdir tags mkdir trunk cp -r /myproject /svn_master/trunk svnadmin create myproject_svn svn import trunk/myproject file:///svn_master/myproejct_svn -m "initial import" it has set svn repository now. how can checkout this? isn't working when try checkout xcode organizer, give path file:///svn_master/myproejct_svn. missing something? how setup same thing remote host(my server)? can copy created local repository there , use path? thanks. got sorted. annoying though apple's documentation on doesn't made sense. simple steps should follow is, setup svn repository on remote windows server. used visualsvn . able setup in couple of minutes. from mac, checkout code terminal using "svn co http://serverurl/svn/projectname localdir" command. open project.xcodeproj file , try create repository automatically. make sure enter correct

RAils named routes inside Jquery autosuggest -

i working in rails2.3.11. have javascript like <script type="text/javascript"> $(item).autosuggest("/users/sampledata",{selecteditemprop: "name", searchobjprops: "name,login", ashtmlid: elmid,beforeretrieve: function(string){ $('#spinner').show(); return string; },retrievecomplete: function(data){ $('#spinner').hide(); return data; } }); </script> i trying convert path "/users/sampledata" rails format sampledata_users_path.. how ?? the controller users controller , action sampledata action has def sampledata @users = user.search(params["q"].gsub(/[^ \w]/, "").strip + "*", :limit => 8) js = [] @users.each |user| js << {:value => user.id.to_s, :name => user.name, :image => user.avatar.url(:micro), :login => user.login} end respond_to |format| format.json { render :json => js.to_json } end end is above "jav

ruby - Resolv an error -

a = [1,0,1] b = [101101, 0101100, 1011001101, 11000111, 1010110] = 0 j = 0 c = [] x = 0 d = [] while x < 5 c.push b[i].to_s.split('') p c x = x +1 end while < 5 e = c[i].length e = e + 1 while j < e d[i][j] = a[i][j % 3] ^ b[i][j] puts d j = j + 1 end = + 1 end ==> resolv error line : d[i][j] = a[i][j % 3] ^ b[i][j] ====> __.rb:18: undefined method `[]=' nil:nilclass (nomethoderror) i not see .. thanks if want use d[i][j] should create 2 dimension: ... d[i] = [] while j < e d[i][j] = a[i][j % 3] ^ b[i][j] puts d j = j + 1 end ... but it's strange code anyway. why using a[i][j % 3] if a one-dimensional array?

google chrome - opening an xml file via hyperlink show xml as regular text -

Image
i want show xml file inside iframe. works fine in firefox , ie in chrome show xml text. so wanted check if general problem. example: if use view xml food menu link located in http://www.w3schools.com/xml/xml_examples.asp xml shown text file. if right click link , chose open in new tab show xml should. or if open new tab , put url http://www.w3schools.com/xml/simple.xml shows file xml file. if press right mouse button , select "open in new tab" show xml should. i think whatever causes problem causes problem facing. questions are: what causes ? is there way around problem ? is bug in chrome ? thanks. chrome version 11.0.696.65 os: windows xp,i have checked in windows 7 for me definitely google chrome bug. try use right-click on link , select "open link in new tab" or "open link in new window" see pretty printed xml. there target="_blank" attribute within anchor element, causes problem: <a target="

php - Wordpress - How do i create category/tag/date filters? -

i'm attempting create 'jobs' page on wordpress website. each job has category (eg. designer), , tag location (eg. australia). currently each 'job' 'post' in wordpress. i'm hoping provide ability users sort jobs either category , tag , date , or combination of 2 or 3. i've tried bunch of plugins no avail, , wondering if please lend hand explain how may have accomplished this, or me out in other way. kind regards, glen perhaps should create custom post type of 'job' category, tag , date taxonomies . can use wp_query display -and sort- job listings. tutorial should enough started: http://new2wp.com/pro/wordpress-custom-post-types-and-taxonomies-done-right/

entity framework - How to map association for Navigation property to select but not update? -

i have navigation property of entity mapped table (a "link table" enabled many many relationship). this selects data navigation property. update have written sp update link table, exists in function imports in model, can call, exposed on context. however, updating entity , saving causes exception: unable update entityset 'setname' because has definingquery , no element exists in element support current operation. , since have not mapped function insert calling imported function on context. is there way update entity's association select link table , leave update/insert handled other code? this has been solved mapping link table entity in edm, associating appropriately (with navigation properties), including sp in edm, mapping sp insert function , unit testing. seems happy.

ruby - Derived Class shares class variables? -

i have class cache , 2 derived classes foo , bar (simplification, principle same). class cache @@test = [] def self.test @@test end def self.add(value) @@test << value end end class foo < cache end class bar < cache end running following leads me conclude @@test not unique foo , bar , unique cache , don't want nor expect. foo.add(1) #[1] bar.add(2) #[1,2] puts foo.test #[1,2] isn't supposed be: foo.add(1) #[1] bar.add(2) #[2] puts foo.test #[1] how can behaviour want? why ruby doing strange? the solution in case not use static classes, 2 instances of class wanted , storing them in static variable.

android - insert edittext between two other edittexts with inflater -

i totally new android , programming, , have helped me ton far. have hit roadblock,however. (sure there many more come) i adding edittexts dynamically layoutinflator vertical linearlayout. when select edittext in middle , hit button inflate edittext, need know how insert new edittext directly below 1 selected, pushing rest down, instead of adding after last 1 added. thanks in advance valuable time, chris linearlayout has addview(view view, int index) method can use put new view @ specific position.

Convert Java object to XML -

i trying convert java object inside of java library xml file. however, got problem: a = new a(); // initializing jaxbcontext jc = jaxbcontext.newinstance("librarya.a"); marshaller marshaller = jc.createmarshaller(); marshaller.setproperty(marshaller.jaxb_formatted_output, true); marshaller.marshal(a, system.out); then got exception: javax.xml.bind.jaxbexception: "librarya.a" doesnt contain objectfactory.class or jaxb.index @ com.sun.xml.internal.bind.v2.contextfactory.createcontext(contextfactory.java:186) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ javax.xml.bind.contextfinder.newinstance(contextfinder.java:128) @ javax.xml.bind.contextfinder.find(contextfinder.java:290) @ javax.xml.bin

What is the best way to implement a tree in matlab? -

i want write implementation of (not binary) tree , and run algorithms on it. reason using matlab rest of programs in matlab , usful analysis , plotting. initial search in matlab found there aren't thing pointers in matlab. i'd know best ( in terms on convinience) possible way in matlab ? or other ways ? you can matlab objects must make sure use handle objects , not value objects because nodes contain cross-references other nodes (i.e. parent, next sibling, first child).

c# - Equivalent java code to measure response time of server -

what equivalent java api s should using following c# code please? need check response time. httpwebrequest request = (httpwebrequest)webrequest.create(address); system.diagnostics.stopwatch timer = new stopwatch(); timer.start(); httpwebresponse response = (httpwebresponse)request.getresponse(); timer.stop(); timespan timetaken = timer.elapsed; thanks in advance. try: long start = system.currenttimemillis(); //dosth. long elapsed = system.currenttimemillis() - start; for more precision use system.nanotime() returns nano seconds between 2 calls. note this: this method provides nanosecond precision, not nanosecond accuracy. a simple way read url , measure speed might be: long start = system.currenttimemillis(); url url = new url(urlstring); url.getcontent(); long elapsed = system.currenttimemillis() - start;

How to install the C library on MinGW? -

how can install c library in mingw? i error when want run scripts: cannot find <clang-c/index.h> please ensure libclang installed how fix problem? that library available llvm project. clang "a c language family frontend llvm." don't believe make binary releases yet. so, need check out code using subversion (svn) , , build library under mingw. please refer " getting started: building , running clang " page detailed instructions.

About Android button event -

hi new in android application development.i practicing android development while.here trying do: in screen there 2 spinner named "to" , "from" , 2 edit text button named "amount" , "result".i want following: when clear button clicked reset “to” , “from” default values , clear “amount” , “result”. can have idea?it helpful if code. thanks. this crude code, haven't tested, wrote on top of head, there can errors , assumed layout ids. need figure out. public class spinnerexample extends activity { private string array_spinner[]; private spinner tospinner; private spinner fromspinner; private button btnclear; private edittext etamount; private edittext etresult; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); array_spinner=new string[3]; array_spinner[0]="1"; array_spinner[1]="2"; array_spinner[2]=&

listview - android horizontallist view -

how add horizontal listview inside listview.i have source code horizontal listview. want add in listview each row in list scrollable. any example great help. thanks i recomend use scrollview tablelayout mutch better.

winapi - Windows kernel equivalent to FreeBSD's ticks or Linux' jiffies in the latest WDK -

i working on windows ndis driver using latest wdk in need of millisecond resolution kernel time counter monotonically non-decreasing. looked through msdn wdk's documentation found nothing useful except called tstime, not sure whether made-up name example or actual variable. aware of ndisgetcurrentsystemtime, have lower-overhead ticks or jiffies, unless ndisgetcurrentsystemtime low-overhead. it seems there ought low-overhead global variable stores sort of kernel time counter. has insight on may be? use kequerytickcount . , perhaps use kequerytimeincrement once able convert tick count more meaningful time unit.

mysql - Delayed insert due to foreign key constraints -

i trying run query: insert `productstate` (`productid`, `changedon`, `state`) select t.`productid`, t.`processedon`, \'activated\' `tmpimport` t left join `product` p on t.`productid` = p.`id` p.`id` null on duplicate key update `changedon` = values(`changedon`) (i not quite sure query correct, appears working), running following issue. running query before creating entry 'products' table , getting foreign key constraint problem due fact entry not in products table yet. my question is, there way run query, wait until next query (which updates product table) before performing insert portion of query above? note, if query run after product entry created no longer see p. id being null , therefore failing has performed before product entry created. ---> edit <--- concept trying achieve follows: starters importing set of data temp table, product table list of products (or have been in past) added through set of data temp table. ne