Posts

Showing posts from July, 2010

iphone - UITableView CustomCell crash on Button Click -

this common question @ though have google , cross check code few times not able figure out crash *** -[mycustomcell performselector:withobject:withobject:]: message sent deallocated instance 0x96f6980 i have customcell named mycustomcell xib have 3 buttons facebook,twitter,linkedin. gave them ibaction in customcell class. when click on of them kind of crash. i using arc. in viewcontroller class have cellforrowatindexpath { static nsstring *cellidentifier = @"mycustomcell"; mycustomcell *cell = (mycustomcell*)[mytableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:cellidentifier owner:self options:nil]; cell = (mycustomcell *)[nib objectatindex:1]; } return cell; } mycustomcell.m - (ibaction)facebookpressed:(basebutton *)sender { } - (ibaction)twitterpressed:(basebutton *)sender { } - (ibaction)linkedinpre...

php - Multiple Submit buttons, how do determine which one was clicked? -

i have form multiple submit buttons. each submit button img src trash can denotes delete icon messages in web based messaging mail inbox what best way figure out submit button icon clicked can write php/mysql code delete message? if(!empty($_post)){ // how figure out submit button has been clicked id of message delete? } <form method="post"> <input src="http://www.foo.com/img.png" id="button_1"> <input src="http://www.foo.com/img.png" id="button_2"> <input src="http://www.foo.com/img.png" id="button_3"> <input src="http://www.foo.com/img.png" id="button_4"> ... <input src="http://www.foo.com/img.png" id="button_100"> </form> set value each submit button , check in php , find 1 clicked <form method="post"> <img src="http://www.foo.com/img.png" id="button_1" name=...

Django urls: match '^$' and '^page/\d+)/$' in one urlpatterns -

i have view: index(request,page=1) for now, use match both "" , "page/\d+" views.index: url(r'^$', views.index) url(r'^page/(?p<page>\d+)/$', views.index) there many views need match both "" , "page/\d+", wonder if there easy way match 2 kinds of urls.thank you. you can use following url. url(r'^$|^page/(?p<page>\d+)/$', views.index) but have change view function follow: def index(request, page): if page none: page = 1 ... note : adds complexity in urlpatterns forget because makes harder debug , read.

c# - Unable to update the GridView in .Net (Date fields are not updating) -

below code gridview , query update , insert....but when update grid values update in database except date(all 3 fields). after updating date fields value null in database... using datepicker calendar. <asp:gridview id="gridview1" runat="server" cellpadding="5" forecolor="#333333" width="1000px" gridlines="none" onpageindexchanging="gridview_pageindexchanging" allowsorting="true" onsorting="gridview_sorting" autogeneratecolumns="false" borderstyle="outset" cellspacing="1" font-names="cambria" font-size="small" allowpaging="true" showfooter="true" showheaderwhenempty="true" datasourceid="sqldatasource1" onselectedindexchanged="gridview1_selectedindexchanged" > ...

Compiling VB6 Code on all files automatically -

i wanted regarding vb6 code. use different scada softwares ifix ge or vijeo citect schneider. front view of different files made these softwares graphic , end respective code of graphic in vb6 format. there thousand of graphics have huge amount of vb6 code in end. wanted know how can compile codes automatically. using vb6 software microsoft can access / open graphics in respective application. can go in script dont know how can compile code after automatically. 1 shed light. if has idead regarding same please reply. thanks & regards ptd we compile in normal batch file: for dll , ocx: "c:\programme\microsoft visual studio\vb98\vb6.exe" /makedll "c:\sourcecode\controls\education\education.vbp" for executables "c:\programme\microsoft visual studio\vb98\vb6.exe" /make "c:\c4sourcecode\programs\consolidate\concolidate.vbp" is looking for?

mongodb - Mongo Java finding Maching record in mongo array -

my sample doc is { "_id" : objectid("51f89c1484ae3aa758ad56e9"), "group_name" : "operator", "privileges" : [ "add group", "edit/delete group", "add user", "edit/delete user", "log history", "add stopwords group", "edit/delete stopwords group", "add stopwords", "edit/delete stopwords", "recomended stopwords" ], "users" : [ { "full_name" : "operator1", "user_name" : "operator", "password" : "pass$123", "status" : "active" }, { "full_name" : "sumit dshpande", "user_name" : "dsumit", "password" ...

windows - Visual Studio Throws Error: There is no editor available for <Crystal Report>.rpt -

Image
environment: windows 7; crystal report 13.0.6; visual studio 2012; there reports in vs project not open , throws error as: note: project migration vs 2005 vs 2012 , crystal reports visual studio.net sap crystal report developer version visual studio.net 13.0.6. i figured out self. answer responded in sap crystal report forum here

select an unknown class in jquery -

we write code in js select class(whitn't class or id name): var x=document.getelementsbytagname("p"); x[2].style.color="red" please note x! how in jquery?! try .css() selecting .eq() choose this $(document).ready(function(){ $("p:eq(2)").css("color","red"); //or $("p").eq(2).css("color","red"); }); consider x[2] select 3rd 'p' tag eq(2) do.

ruby on rails - Duplicate error messages with validates_associated -

here 2 classes, 1:n relation class company < ar::base has_many :brands validates_associated :brands end class brand < ar::base belongs_to :company validates_presence_of :name end i try add brands company. if brand name empty, gives me duplicated error messages. c = company.find(1) c.valid? # => true c.brands.new # => #<brand id: nil, name: nil, company_id: 1, created_at: nil, updated_at: nil> c.valid? #=> false c.errors.full_message #=> ["brands invalid", "brands invalid"] c.brands.last.errors.full_message #=> ["name required"] validates associated can achieved 2 ways first option simple: has_many :brands, validate: true second option using validates_associated cause duplicate error message , can avoided explicitly setting validate false: has_many :brands, validate: false validates_associated :brands note: can go second option if need additional options validates_associated :if, :unless...

java - Add a custom field type in solr -

in solr schema.xml many field types defined. example <fieldtype name="int" class="solr.trieintfield" precisionstep="0" positionincrementgap="0"/> is definition integer field. how define custom field types inside solr? is possible add java types such biginteger, bigdecimal, map , other types field type in solr? you can define new custom fields in solr adding them schema.xml in <fields> element: <fields> ... <field name="newfieldname" type="text_general" indexed="true" stored="true" multivalued="true"/> ... </fields> to have overview on supported types (used define <fieldtype> in solr, used define field elements), take link: https://cwiki.apache.org/confluence/display/solr/field+types+included+with+solr . example, type "text_general" defined in schema.xml as: <fieldtype name="text_general" class="solr.te...

Opening default android browser with a URL and parameter passing in android -

i'm trying pass on url of form: http://foo.com?param1=somevalue to android browser, however, once url sent browser in form exactly, the browser seems append forward slash url follows: http://foo.com/?param1=somevalue and surprisingly, android browser having trouble parsing this. i'm not sure why breaks url. the invoking code this: intent sampleintent = new intent(intent.action_view, uri.parse(sampleurl)); startactivity(sampleintent); is bug android browser or need differently here? if closely read how can open android browser specified post parameters? question , comments, think might answer. says cannot add params post start browser using intent, allows that. there solution @pete doing wish, inside webview (if might want consider): webview webview = new webview(this); setcontentview(webview); byte[] post = encodingutils.getbytes("postvariable=value&nextvar=value2", "base64"); webview.posturl("http://www.geenie.nl/...

android - Showing partial number of elements in a scrollView -

objective: list partial number of elements in list, showing more elements if user want to. example, orilist list contains 38 elements, default there first 20 elements being show, when button "show more" being clicked, remaining 18 elements showed. requirement: each of element have included row in tablelayout implementing scrollview. may know how can achieve objective?

concurrency - RavenDB keeps throwing a ConcurrencyException -

i keep getting concurrencyexception trying update same document multiple times in succession. put attempted on document '<id>' using non current etag message. on every save our ui publish event using masstransit. event sent subscriberqueues, put eventhandlers offline (testing offline subscribers). once eventhandler comes online queue read , messages processed intended. however since same object in queue multiple times first write succeeds, next doesn't , throws concurrencyexception. i use factory class have consistent idocumentstore , idocumentsession in applications. set useoptimisticconcurrency = false in getsession() method. public static class ravenfactory { public static idocumentstore createdocumentstore() { var store = new documentstore() { connectionstringname = "ravendb" }; // setting conventions store.conventions.registeridconvention<mytype>((db, cmd, e) => e.myproperty.tostring()); st...

android - how to create expendable layout on each node -

im creating , application have thre nodes (description, contents, nutrition) image http://imgur.com/tmjt6gi when user click node expend , show screen inside how that? see there expendable listview available show single list on each node example http://ranfeng0610.blog.163.com/blog/static/1857082842011727111359969/ expend listview in each node lie expend layout on reach node al node show difrent layout user interface) how willl make screenlike this? me please u have idea???? 1、main.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- 禁用系统自带图标android:groupindicator="@null" --> <expandablelistview android:layout_width="fill_parent" android:layout_height="wrap_content" android:groupin...

sql - Mysql query to dynamically convert rows to columns on the basis of two columns -

i have followed question here use mysql query dynamically convert rows columns. works fine, need convert on basis of 2 columns, the query mentioned in above link works single column "data", want work 2 columns "data" , "price". i have added example here, given table a, like table | id|order|data|item|price| -----+-----+---------------- | 1| 1| p| 1 | 50 | | 1| 1| p| 2 | 60 | | 1| 1| p| 3 | 70 | | 1| 2| q| 1 | 50 | | 1| 2| q| 2 | 60 | | 1| 2| q| 3 | 70 | | 2| 1| p| 1 | 50 | | 2| 1| p| 2 | 60 | | 2| 1| p| 4 | 80 | | 2| 3| s| 1 | 50 | | 2| 3| s| 2 | 60 | | 2| 3| s| 4 | 80 | i write query looks following: result table | id|order1|order2|order3|item1|item2|item3|item4| -----+-----+--------------------------------------- | 1| p | q | | 50 | 60 | 70 | | | 2| p | | s | 50 | 60 | | 80 | i have tri...

how to change imagview margins dynamically based on button click in android -

hi trying change imageview postion based on button click event,i tried using below code,if click button1 ic_lancher image showing 1 postion,and again click button2 here changed left margin, image not moving,but in button2 on click if gave different background means time moving perfeclty,if give same background in both button on clicks ,just changing postion of image means not working good,first image displayed if click buttons image not moving,its present in same postion... 1 suggest me how solve this... public class mainactivity extends activity { button b1,b2; imageview arrow; float screenheight,screenwidth,screendensity; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen); displaymetrics displaymetrics = new displaymetrics(); getwindowmanage...

How to exclude content elements indexing via typo3 index search and crawler -

when crawled content backend index content . wanted exclude perticular content area or ( perticular content elements ). i using typo3 version 4.7.12 , index search 4.7.7 , crawler version 3.5.0 any ideas please let me know... thanks in advance. in addition can insert markers html comments define part of body-text include or exclude in indexing: the marker <!--typo3search_begin--> and/or <!--typo3search_end--> rules: if there no marker @ all, included. if first found marker “end” marker, previous content until point included , preceeding code until next “begin” marker excluded. if first found marker “begin” marker, previous content until point excluded , preceeding content until next “end” marker included. copy & pasted documentation

android - how to get the realy activity name but not Subsetting in Setting -

when check log hierarchyviewer setting menu. found display subsetting whatever click button. (for example, when click wi-fi, display subsetting, when click bt, display subsetting, too). check info intenet, because fragment.... want know how realy setting name(like before android 3.0). the short answer settings sub-screens not implemented using separate activities, there no way 'real' activity looking for. settings screens, activity subsettings activity hosts various fragments. more details: in earlier versions of android, settings sub-screens each implemented own activities. beginning around gingerbread, android re-architected settings app (and preferenceactivity) use fragments instead of actual activities settings sub-screens. allows them support split-pane settings user interface (with settings headers on left, , settings details on right). example in froyo, wifi settings implemented activity called wifisettings, later implementations use subclass of fragment (...

c# - Set UI elements on equidistant points on circumference of an ellipse using XAML -

i'm making analog clock-like app , need numbers (represented buttons) on clock face @ equidistant points 1 another. there way identify specific ponts , distances between them on ellipse , place ui elements centered on appropriate points? have feeling need use canvas logic implementation evades me. in other words, how place buttons or other controls on equidistant points along predefined geometry anchored points? http://www.charlespetzold.com/blog/2006/04/070132.html here xaml clock great charles petzold http://www.codeproject.com/articles/29438/analog-clock-in-wpf and here solution in wpf should portable

github - How to commit using Git without touching a folder -

i have project contains many folder. want commit folder except 1 lets suppose name photo . how can commit whole project without touching folder using git adding folder .gitignore should do, if never want commit folder. however, if want ignore folder temporary, solution stage ( prepare commit ) everything, , unstage mentioned folder: git add . git reset path/to/directory this way can craft commit without folder , add folder in separate commit.

Oracle - SQL Distinct Select on alias -

i selecting aliasing columns like select t.name, t.surname table t conditions...; now want add distinct function on particular column, therefor if selecting without alias like: select distinct(name), surame table; but how shall write select query on aliased colum names? select distinct(t.name) not works, neither select t.distinct(name) ; how shall write select query on aliased column names? you cannot write select query on aliased column names. aliases useful following: there more 1 table involved in query functions used in query column names big or not readable two or more columns combined together

WinJS/ Windows Phone HTML and Twitter Bootstrap -

is there case trying integrate twitter bootstrap ( v3 rc1 @ time of writing) windows store winjs app or windows phone html5 app? it strikes me mobile first/ responsive nature of bootstrap lend rending in full screen mode , snapped view mode alike - in case of windows store app. given traction bootstrap gaining each day, worth attempting? i can see being able use themes places {wrap} bootstrap , bootswatch , name few, incredibly useful - if you're trying create consistent brand across web , devices. an issue may how work panorama-like components... it depends. if want more custom experience in app , not use winjs think worth it, when win 8.1 comes out , apps have work , scale 500px width large widths of desktop monitors (no more snapped mode). if want fit in win 8 ux guidelines think twitter bootstrap more of problem help. microsoft has developed quite extensive set of ux guidelines laying out page , margins, font sizes animations etc. they did of win...

c++ - (How) can I select a Windows Store app with a file browser? -

i'm working on introspection utility asks user specify executable use launching application. i'd add support so-called "windows store apps" (formerly known "metro" apps, believe). however, it's not clear me how stored locally. i read how windows store apps packaged , deployed , , apparently it's common distribute them .appx files, generated tools makeappx . however, don't see if/where stored locally. does make sense address them ordinary executables @ all, i.e. via file name? or there rather more appropriate method? noticed in registry, (all?) of windows store apps have installed listed beneath hkcu\software\classes\activatableclasses\package is there api available handling registry tree, stuff "get me user-visible name" or "get me appusermodelid can launch app"?

java - What is the cost of try catch blocks? -

how better is: if (condition) { try { //something } catch(someex ex) {} } instead of this: try { if (condition) { //something } } catch(someex ex) {} what jvm when enter try block ? edit: don't want know in second example go in try... please answer question. execution wise @ run time, long there no exception, try not cost anything. costs run time exception occurs. , in situation slower if evaluation. in jvm spec, see there no byte code generated on execution path: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-3.html#jvms-3.12

c# - Does Conditional attribute eliminate subexpressions too? -

i have c/c++ background. put heavy assertions on code, , in c or c++ there's no guaranteed way eliminate evaluation of subexpressions assertion parameter. had use macro. in c#, don't have level of macro support. have conditional attribute. in experience c , c++, subexpressions cannot eliminated due side-effects. for example, [conditional(debug)] void func1(int a) { // something. } int func2() { // called? } func1(func2()); if func2 still being called, should code isdebugmode() && func1(func2()) . want avoid. want know conditional attribute guarantees elimination of subexpressions or not. if doesn't, what's best practice write debug build assertion stripped @ release build? afaik, compiler specific support. want know case of mono compiler. func2 won't called. stated in c# language specification mono compiler must act according these rules. msdn http://msdn.microsoft.com/en-us/library/aa664622(v=vs.71).aspx : the a...

Android app name not changed in status bar when launching in eclipse -

the situation: i decided change app's name, changed package name, strings.xml, , manifest file. also searched , replaced in project's files. but when launch app on eclipse "launching oldappname" pm bottom right corner. the first offers: people here offered me things tried my failed attempts: tried copying files (in res, src) new project, didn't help my succesful attemps: copied entire directory, , opened in computer, , showed right name my remaining question: value be? , why still show there? i solved this: eclipse -> project -> properties -> run/debug settings, in window, select "launch configuration" project, if has wrong name, delete it. next time launch project, eclipse ask whether launch android application or else. choose "android application". --> new launch configuration correct name created.

python - Conditional expression in PyTables where method -

i want use conditional expression in pytables method. in sql, use case expression (postgresql, "case when a=b 1 else 0"), if usual python, use conditional expression "1 if a==b else 0". couldn't find how can done in pytables where method. i checked http://pytables.github.io/usersguide/condition_syntax.html don't know if it's possible. you can use where(predicate, num1, num2) . table.where('where(a==b, 1, 0) == c') according conditional syntax where(bool, number1, number2): number - number1 if bool condition true, number2 otherwise.

how to get video's real size in html5 -

to play video in html5 correctly,i save videowidth , videoheight values of video when capturing loadedmetadata event.what surprised me both values 100 on android browse while 480*640 on iphone safari real size. find reason, i've tried other browsers such chrome,uc.i surprised find values of videowidth , videoheight wrong under various android browses.why?can help! it appears issue metadata loading , when query size default 100x100. if specific check after durationchange event shows duration greater 1s see correct values videowidth , videoheight (i've found html5 video in android relying on before duration shows greater initial default of 1s problematic)

c# - Get data from an API to my server every minute -

here's api server can give me real time news: every minute there new retrieve. there's web page, javascript ask api news once every minute. and not fine... unless web page made single user , open on 1 machine @ time (which not case of internet). api, infact, restricts number of call can per minute: let's suppose api ban me if more 1 call per minute. if 100 users load web page, api receive 100 calls per minute (!!!). since flow web page >> calls >> api think there no solution without inserting node lazy loads api server. my web page >> calls >> server >> calls every minute >> api since instances of web page may many while server 1 think solution. however, have no idea if: a) correct solution? or somehow web page behave correctly without need of intermediary server? b) how can implement in asp.net mvc4? there support server side timers? c) if can iis retrieve data every minute, should store in database serve web page? ...

iphone - multiple image uploading to server using soap based web service -

i trying run image uploading using soap based web service , doing face 2 key issue in app. issue 1:- when app uploading multiple images server , @ time if application goes in background state @ time stop executing (application suspended state) . when app goes background foreground state again resume background thread. issue 2:- when try upload 160-170 images on server device gallery. received memory warning after uploading 60-70 images on server. handle method , try free memory within application , again start thread @ time application crashed. //->> 2nd issue add 3 different web service , long code not going share here. when check on instrument run on max 2 2.5 mb in live bytes when uploading thread start gradually increasing , @ pick point received received memory warning. code contains feature of arc still got memory warning issue. code issue 1:- - (void)applicationdidenterbackground:(uiapplication *)application { uidevice* device = [uidevice currentde...

css - border-box with percents and margins -

Image
how use border box percentage , margins? example follows. <style> .half{ width: 50%; float: left; background: red; margin: 5px; box-sizing: border-box; box-shadow: 0px 0px 3px black; } </style> <div class="half">half</div> <div class="half">half</div> i want div(.half) take 50% of screen - 5px margin around div posable every time try makes wider 50% , puts second box on next row avoid % based margins if posable. margins never computed part of width, using box-sizing: border-box; so try replacing margin border: 5px solid transparent or, if can't override borders, depending on effect want achieve try :after/:before pseudoelements, e.g. .half { width: 50%; float: left; background: red; box-sizing: border-box; box-shadow: 0px 0px 3px black; } .half:after, .half:before { content: ""; width: 5px; /* or more if need more space */ ...

ios - Not able to move two images using uipangesturerecogniser -

i want move 2 images same uipangesturerecognizer , able move first image, try move second image first 1 goes original position. want first image retain it's after changed position. -(void) viewwillappear:(bool)animated { uipangesturerecognizer *pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepansuper:)]; [self.view addgesturerecognizer:pan]; } - (void)handlepansuper:(uipangesturerecognizer *)sender { static uiimageview *viewtomove; static cgpoint originalcenter; if (sender.state == uigesturerecognizerstatebegan) { cgpoint location = [sender locationinview:self.view]; if (cgrectcontainspoint(self.imageview.frame, location)) { viewtomove = imageview; originalcenter = viewtomove.center; } else if (cgrectcontainspoint(self.image2.frame, location)) { viewtomove = image2; originalcenter = viewtomove.center; } else { viewtomove = nil...

asp.net mvc - Synchronizing my records between two separate databases -

i building bpm based on asp.net mvc, working on 2 systems:- a third party bpm. my own bpm system. currently when adding new process doing following:- create new process @ third party application using rest api. create new process @ own bpm database. but facing following problems:- how can add/edit/delete records 2 systems consistence manner, if record not added in third party system have remove system, , visa versa. my process model class is:- public class newprocess { public string name { get; set; } public string activityid { get; set; } public string status {get; set;} } my action method is:- [httppost] public actionresult createprocess(string name) { using (var client = new webclient()) { try { repository.createprocess(name,"pending"); repository.save(); var query = httputility.parsequerystring(string.empty); query["j_username"] = "kermit"; query["hash"] = "9449b5abcfa9afda36b...

bash - How to match digits in regex -

i'm trying match lines against regex contains digits. bash version 3.2.25: #!/bin/bash s="aaa (bbb 123) ccc" regex="aaa \(bbb \d+\) ccc" if [[ $s =~ $regex ]]; echo $s matches $regex else echo $s doesnt match $regex fi result: aaa (bbb 123) ccc doesnt match aaa \(bbb \d+\) ccc if put regex="aaa \(bbb .+\) ccc" works doesn't meet requirement match digits only. why doesn't \d+ match 123 ? either use standard character set or posix-compliant notation: [0-9] [[:digit:]] as read in finding numbers @ beginning of filename regex : \d , \w don't work in posix regular expressions , use [:digit:] though so expression should 1 of these: regex="aaa \(bbb [0-9]+\) ccc" # ^^^^^^ regex="aaa \(bbb [[:digit:]]+\) ccc" # ^^^^^^^^^^^^ all together, script can this: #!/bin/bash s="aaa (bbb 123) ccc" regex="aaa \(bbb [[:digit:]]+\) cc...

iphone - mapkit framework is not present in xcode -

Image
i working on project using mapview, in projects build phases mapkit framework not present problem, please check image below take mapkit framework xcode or download frameworks section in apple developers website. have copy , add xcode or can add project folder contains frameworks. if still don't come have reinstall xcode. hope works out fine. or can directly download here mapkit.framework

Can't find static files for the Django admin interface -

i can't find answer seems simple question. i have django 1.5 app on heroku using staticfiles . static files defined within app can found fine: $ heroku run python manage.py findstatic bootstrap.min.css running `python manage.py findstatic bootstrap.min.css` attached terminal... up, run.5557 found 'bootstrap.min.css' here: /app/myapp/static/bootstrap.min.css but static files built-in admin interface can't found, e.g. $ heroku run python manage.py findstatic base.css running `python manage.py findstatic base.css` attached terminal... up, run.4546 no matching file found 'base.css'. the relevant bit of settings is, guess, this: staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', ) for clarity, else on admin interface works, not static css files. if visit admin login page, server logs have: no such file or directory: 'staticfiles/...

javascript - Automatically Highlight Navigation Links on Horizontal Free Scrolling Website -

i have particular page set of images contained in white-space:nowrap div, page scrolls horizontally. there's fixed (main) navigation menu on left. i have second navigation set, underneath images, when click on various links uses scrollto scroll browser relevant image. second navigation menu contained in fixed div , made of series of links various anchors associated images. i way of attaching , removing active class these links (i.e. addclass() ) depending on browser window (and in view). i have found lots of vertical versions of this, js knowledge isn't fantastic , haven't been able convert these used horizontally. essentially horizontal version of jsfiddle . i have come across plugin, haven't managed work me either: here thank you! this fiddle horizontal: http://jsfiddle.net/x3v6y/ i made little change on html, , here js: $(function(){ var sections = {}, _width = $(window).width(), = 0; // grab position...

asp.net mvc - Need help to understand how Moq resolved the actual query -

below test case runs fine. [testmethod] public void getcompanies_wheninvokedwithsearchtext_shouldreturnfilteredcompanies() { // arrange var context = new mock<idatacontext>(mockbehavior.strict); var companies = new list<company> { new company() { address = "london", name = "abc inc." }, new company() { address = "newyork", name = "toyota" }, new company() { address = "ealing broadway", name = "amazon" } }; context.setup(s => s.query<company>()).returns(companies.asqueryable()); var repository = new companyrepository(context.object); // act var expectedcompanies = repository.getcompanies("abc"); // ...

Encrypt data using c# and decrypt it using openssl api, why there are lots of trashy padding at the end of decrypted data? -

i using rsa(1024) encrypt/decrypt strings. encryption implemented using public key , written in c#, , decryption implementation c. encrypt string: 86afaecb-c211-4d55-8e90-2b715d6d64b9 and write encrypted data file. then, using openssl api read encrypted data file , decrypt it. however, got output as: 86afaecb-c211-4d55-8e90-2b715d6d64b9oehebjq8fo1amdnor1d3blupyq9wjbaov+m/wvnyzyr pjbkoskoj+4lanpt+spkfk81nsnqebhbjgao4ehnu+pmwl9 it seems there trashy padding @ end of original string. why occurs? , how solve problem? some code snippet shown below: // encrypt { string plaindata = “86afaecb-c211-4d55-8e90-2b715d6d64b9”; rsacryptoserviceprovider rsa = new rsacryptoserviceprovider(); rsa.importparameters(parapub); byte[] testdata = encoding.utf8.getbytes(plaindata); byte[] encrypteddata = rsa.encrypt(testdata, true); filestream pfilestream = null; string filename = "encrypteddata.dat"; pfilestream = new filestream(filename, fi...

java - How to display ArrayList items in a JComponent -

i have this: arraylist lovely = new arrylist(4); lovely.add("tall, short, average"); // line 1 lovely.add("mangoes, apples, bananas"); // line 2 lovely.add("this, that"); // line 3 lovely.add(“1, 2, 3, 4, 5, 6”) // line 4 i'd have array list displayed in such way each category shows in own line, how google list search results. know how this? i'd such displayed in jcomponent, not sure of 1 use, nor how this. java programmers use jtextfields , jtextpanes, or use. help here appreciated. java programmers use jlist . can constuct this: new jlist(lovely.toarray()) it displays each item in separate line in list.

hibernate - Grails - DuplicateKeyException -

i have got following piece of code adds new object database. firstly takes object db , add final object. few lines of code classc c = classc.findbyname(cname) classd d = new classd( name: "whatever", classc: c ) print "aaa\n" classc.withtransaction { c = c.merge() // c.save(failonerror: true, flush: true) } print "bbb\n" // classd.withtransaction { // d = d.merge() // } // print "ccc\n" classd.withtransaction { d.save(failonerror: true, flush: true) } print "ddd\n" i have got following error: aaa bbb 2013-07-31 13:57:14,279 error jobrunshell - job default.1 threw unhandled exception: org.springframework.dao.duplicatekeyexception: different object same identifi...

c++ - Storing path from A*, using operator::new with boost::multi_array -

i'm trying use dynamic memory allocation first time. want allocate memory 2 dim dynamic array, store paths a* function. think array job boost::multi_array. problem seem able allocate memory can't change or access of elements. #include <iostream> #include "boost/multi_array.hpp" typedef boost::multi_array<int, 2> array_type; int main() { array_type *a = new array_type; a->resize( boost::extents[2][2] ); a[1][1] = 2; std::cout << a[1][1] << std::endl; delete a; return 0; } compiler says : c:\coding\code projects\c++\source files\console\main-read.cpp|14|error: no match 'operator<<' in 'std::cout << boost::multi_array_ref<t, numdims>::operator[](boost::multi_array_ref<t, numdims>::index) [with t = int; unsigned int numdims = 2u; boost::multi_array_ref<t, numdims>::reference = boost::detail::multi_array::sub_array<int, 1u>; boost::multi_array_ref<t, num...

highcharts - how to display both the series value in plotoptions mouseover event -

using tooltip formatter can display both series name , value when same done using plotoptions event mouseover not able series name , value tooltip: formatter plotoption: mousover mouseover: function () { $.each(this, function (i, e) { $reporting.html('x: ' + this.x + 'category: ' + this.series.name + ', y: ' +highcharts.numberformat(math.abs(this.y))); }); } example of using in mouseover mouseover: function () { console.log(this); var series = this.series.chart.series, x = this.x, y = this.y, output = 'x: ' + x + 'y: ' + highcharts.numberformat(math.abs(y)); //loop each serie $.each...

How to prevent loading of knockout.js by requirejs? -

i'm using requirejs loading majority modules, need load single script knockout.js old-fashioned manner using: <script src='/path/to/knockout.js' ></script> i have trouble it, when page rendered see markup: <script async="async" type="text/javascript" src="knockout.min.js"></script> but don't want load knockout using require.js. how disable loading using require.js specified script? i found solution: after digging sources of knockout , found interesting pice of code, determine existance of require.js , automatically registers module in require , here guilty chunk of code: // support 3 module loading scenarios if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { // [1] commonjs/node.js var target = module['exports'] || exports; // module.exports node.js factory(target); } else if (typeof d...

sql - Check if variable can be cast against a dynamic datatype -

i creating import application in vb.net sql server 2008 database. trying make import generic possible reduce maintenance in future. therefore gets available columns preset list of tables in can import into. the main problem have gotten point doing error trapping. try check see whether value being imported castable data type of field in database. example, if want import date database mistakenly put address field instead, want pick , alert user. so, have vb datatable same schema database table , value go datatable. below have (which not alot): private sub setvalue(targetdatatable datatable, columnname string, value string) dim dbtype type = targetdatatable.columns(columnname).datatype ???? end sub i have done research reflection still requires me define datatypes. there other ways of doing this? don't think there way automatically type, according msdn there 18 types supported should manageable. private sub setvalue(targetdatatable datata...