Posts

Showing posts from August, 2014

c# - Can't receive data from intent -

i using monodroid make application. in application user clicks button goes listview, listview has multiple options, user selects on option , option sent original class textview changed same text option on listview selected. below class sends data protected override void onlistitemclick(listview l, view v, int position, long id) { int t = labels[position]; string text = t + ""; intent send = new intent(this, typeof(createvehicle)); send.setflags(activityflags.cleartop | activityflags.singletop); send.putextra("t", "data firstactivity"); startactivity(send); } below receiving class: protected override void onresume() { base.onresume(); // call superclass first. textview tvyearchange = findviewbyid<textview>(resource.id.tvyearchange); string text = intent.getstringextra("t") ?? "work"; tvyearchange.settext(text, null); }...

When I use vim on my own computer all text is the same color even when I use a python file -

how fix this? dont know how access settings or if did how change them. sorry stupid question driving me crazy. thanks! open .vimrc file, , add line: :syntax on if don't know .vimrc file located, can type in command line: vim --version you should have like: system vimrc file: "/etc/vimrc" user vimrc file: "$home/.vimrc" user exrc file: "$home/.exrc" fall-back $vim: "/usr/share/vim" which tells location of .vimrc file.

c# - Customization, categorization, collecting errors in Antlr -

i new antlr. trying implement css parser. start using this grammar generate parser. following this tutorial guide. generating code in c# using antlr 3.4 (next, going try using antlr 4.0 well). i facing several issues , unable find resources on internet can understand them clearly. issues having: generate customized error messages in different types (errors, warnings). provided in antlr. please provide me resources understand how achieve this. in tutorial following, able catch exceptions in parsing , lexing. in grammar tried not give errors though have added following code , tested on wrong css content. partial class css3lexer { public override void reporterror(recognitionexception e) { base.reporterror(e); console.writeline("error in lexer @ line " + e.line + ":" + e.charpositioninline + e.message); } } i want collect list of errors (parser , lexer errors) in kind of data structure (list of error object has error type, me...

git - Find a Pull Request on Github where a commit was originally created -

Image
pull requests great understanding larger thinking around change or set of changes made repo. reading pull requests great way "grok" project as, instead of small atomic changes source, larger groupings of logical changes. analogous organizing lines in code related "stanzas" make easier read. i find myself looking @ file or commit, , wonder if there way backtrack commit pull request created it. pull request have been merged eventually, not necessary merge-commit. you can go github , enter sha search bar, make sure select "issues" link on left. updated 13 july 2017 via github ui there easy way this. if looking @ commit in list of commits in branch in ui, click on link commit itself. if there pr commit , wasn't added directly branch, link pr listing pr number , branch went directly under commit message @ top of page. if have commit sha , nothing else , don't want go digging around it, add /commit/[commit sha] repo url, , see c...

php - How do I add text to the price of a variable product in Woocommerce? -

i've managed add text price single product, can't find way of adding price of variable product. basically, need declare price including , excluding tax, , i've managed adding text , formula main price. cannot find way alter price variable products. if not possible, inserting (ex. vat) do. you use css insert ex vat after prices. depending on theme prices wrapped in specific id or class, should work. http://www.w3schools.com/cssref/sel_after.asp

.net - Send File Programmability in C# -

how go detecting, blocking, or in general referring send file operation can file/folder on windows. happening when send file happens , there kind of built in programmability in .net or similar how doing move works(it gets deleted first , created in new location.) i want know if there way detect when send file happens or windows file/folder when send file executed. if speaking of "send to" context menu when right-click on file/folder, result of shell extension handler. pretty sure there's way intercept those: is there click handler shell extension ms documentation on registering/creating own handers below: http://msdn.microsoft.com/en-us/library/windows/desktop/cc144067%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/cc144110%28v=vs.85%29.aspx i presume if select "send to" , pick folder/drive, standard move or copy (depending on if same drive or not). mentioned alan, can use filesystemwatcher try , monitor specif...

c - Select() doesn't recognise changes through FD_SET while blocking -

i'm calling fd_set() set write_fd of non-blocking socket while select() blocking within thread – problem select() keeps blocking if fd ready write. what want is: preparing data write socket within thread, afterwards add socket write_fd. select() thread should recognise , handle prepared data. doesn't select() recognise changes within fd while blocking? if yes – there epoll() epoll_ctl_mod instead of fd_set() update set; or way recognise changes set timeout of select()-function? in opinion wouldn't solution because "slow" , produce cpu overhead ... edit: // thread running day long ... static void * workman() { fd_zero(&fd_read); fd_zero(&fd_write); fd_set(socketid , &fd_read); while(1) { // problem keeps blocking when box() called select(socketid+1, &fd_read, &fd_write, null, null); if(fd_isset(socketid, &fd_read)) { // recive data } else if(fd_isset(socketid...

html - Rendering issue in Chrome - Hides part of webpage -

my webpage rendering oddly in chrome on mac. below fold of page, when highlight area comes view, if use "inspect element" shows page should. its not consistently, happens , again. rendering issue: http://albertcrm.com/1.png when highlight: http://albertcrm.com/2.png i have no idea how start debugging this, guess css issue maybe, or chrome rendering issue, maybe js include taking long load?

ios - Resigning Modal View with 2 different segues -

currently have uibarbutton says done in viewcontroller 2. present viewcontroller2 viewcontroller 1 modally through segue defined in storyboard. have viewcontroller3 presents viewcontroller2 modally well. the question: how can define 2 different segues resign viewcontroller2 modally either vc1 or vc3? after further research, seems defining unwindtoviewcontroller in vc1 , vc3 best way go. however, there way call ibaction before modal view unwinds? @implementation redviewcontroller - (ibaction)unwindtored:(uistoryboardsegue *)unwindsegue { } @end modalview .m -(ibaction)actionbeforeunwinding:(id)sender { } why not dismissing presentingviewcontroller? - (ibaction)unwindtored:(id)sender { [self.presentingviewcontroller dismissviewcontrolleranimated:yes completion:nil]; }

c - Find the fault or error -

can find wrong following code? int main(){ char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); } i expected print space followed string! here way use ++*p++ : #include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { char *p = "my test string", p1[15]; strncpy(p1, p, 14); p1[14] = 0; p = p1; while (*p != 0) { printf("%c", ++*p++); } } note p1 array of memory (usually) allocated on stack, whereas p (usually) pointer read memory, above code moves point p1 instead of (usually) read location string resides. operating systems and/or compilers exhibit other behavior, 1 of protection mechanisms built modern oss prevent classes of viruses.

java - How can move file from one directory to another -

i sorry,i modified entire question. i want move specific files(based on fileextension ) 1 directory another. for this, plan write 2 functions names listoffilenames , movingfiles . if pass directorypath , filetype arguments to listoffilenames() ,it returns list<file> data.this list have entire file path. movingfiles() move files source directory destination. i tried movingfiles function, in following way.it's not working. public void movingfiles(string sourcepath,string directorypath,string filetype) throws ioexception { externalfileexecutions externalfileexecutionsobject=new externalfileexecutions(); list<file> filenames=externalfileexecutionsobject.listoffilenames(sourcepath, filetype); (int fileindex = 0; fileindex < filenames.size(); fileindex++) { filenames[fileindex].renameto(new file(directorypath+"/" + filenames[fileindex].getname())) } } i think, need convert list<file> list<string> .t...

java - RuntimeException: Unable to instantiate receiver -

i attempting launch activity after screen unlocked , getting error log below. looked @ other posts regarding issue of them solved problem e/androidruntime: fatal exception: main java.lang.runtimeexception: unable instantiate receiver com.me.phone.receive: java.lang.classnotfoundexception: com.me.phone.receive @ android.app.activitythread.handlereceiver(activitythread.java:2239) @ android.app.activitythread.access$1600(activitythread.java:139) @ android.app.activitythread$h.handlemessage(activitythread.java:1300) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4918) @ java.lang.reflect.method.invokenative(native method) mainifest <uses-sdk android:minsdkversion="14" android:targetsdkversion="17" /> <uses-permission android:name="android.permiss...

android - Invalidate() doesn't actually redraw children -

Image
so, have pretty weird setup, , i'm getting weird visual bugs out of it. basically, have 2 views in relative layout: first imageview background image; second same background image blurred give kind of behind-frosted-glass effect: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/profile_holder" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- background --> <imageview android:id="@+id/backgroundimage" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="0dp" android:layout_margintop="0dp" android:scaletype="centerc...

python - Noisy Scipy Wavfile Output Issue -

i'm trying create .wav file using scipy.io.wavfile.write(), result noisy wav file, have tryed inotebook same result, here code: import numpy np scipy.io import wavfile x= np.arange(25600.0) sig= np.sin(2*np.pi*(1250.0/10000.0)*x) def makewav(data,outfile,samplerate): wavfile.write(outfile,samplerate,data) makewav(sig,'foo.wav',44100) it happens when try generate pure tones. problem when reading .wav whith scipy.io.wavfile.read() , writing again scipy.io.wavfile.write(). according this documentation should output integer values, , have floating point data should have convert them first. the method: scipy.io.wavfile.write(filename, rate, data)[source] argument: data ndarray 1-d or 2-d numpy array of integer data-type. to convert data, try use code: data=np.int16(sig/np.max(np.abs(sig)) * 32767) check out more in answer .

Where to save temp files for Windows Azure website, and access them from worker role? -

i have website users upload images , processes on these images, user download these images, , have windows app deletes these images based on schedule, , deletes images older 1 hour, means user can access uploaded images 1 hour. currently have website , windows app working on same dedicated server, , want move azure. my question is: save these images, need keep 1 hour, , able access these images worker role delete them based on schedule? i put website on windows azure websites the answer depend on web app running, , i'm thinking question may end getting closed due broad nature of it. but... in general, should consider using blob storage images. way, any compute instance in azure can access it, whether in virtual machines, web/worker role instances, or web site instances. as 1-hour access, can set shared access signatures expire in hour. can have these links embedded in html output, , have users direct-access images. deleting, i'm sure there lots of techn...

parsing - Debug parser by printing useful information -

i parse set of expressions, instance: x[3] , x[-3] , xy[-2] , x[4]y[2] , etc. in parser.mly , index (which inside [] ) defined follows: index: | integer { $1 } | minus integer { 0 - $2 } the token integer , minus etc. defined in lexer normal. i try parse example, fails. however, if comment | minus integer { 0 - $2 } , works well. problem related that. debug, want more information, in other words want know considered minus integer . tried add print: index: | integer { $1 } | minus integer { printf.printf "%n" $2; 0 - $2 } but nothing printed while parsing. could tell me how print information or debug that? i tried coming example of describe , able output of 8 show below. [this example stripped down works [1] , [- 1 ], believe it's equivalent logically said did.] however, notice example's debug string in example not have explicit flush %! @ end, debugging output might not flushed terminal until later expect. here's used: test.mll: ...

java - spring bean properties with singleton -

need clarification on spring singleton .i have 3 objects ,these readonly never changed values. i planning create these objects singleton bean properties. my question: when spring creates these objects,everytime create new object when bean calls or once in life time call , create objects?. possible threading issues if any? it depends on spring do. spring has inversion of control container manages instances of objects. depending on scope give objects, make them singletons or not. more info: http://static.springsource.org/spring/docs/3.0.0.m3/reference/html/ch04s04.html

ruby on rails - Thumbnails with Zurb Foundation and RoR -

so started using zurb foundation, , following this documentation . i have following code links designs in database. <div> <div class="small-4 small-offset-4 rows"><h2>most downloaded</h2></div> <% @designs.each |design| %> <div><%= link_to design.title, design_path(design) %></div> <% end %> </div> i wanted on creating thumbnails each link. gist of it, wanted use same picture thumbnails. used a.th class wrap image wanted learn how display more 1 (typically 3) thumbnails on each row. so lets there 9 designs in total, wanted 3 rows of 3 thumbnails each. wasn't able find many tutorials/explanations tips helpful understand how works. check out foundation's block grid: http://foundation.zurb.com/docs/components/block-grid.html . i think you're after. 3 3 thumbnail grid like: <div> <div class="small-4 small-offset-4 rows"><h2>most ...

c# - VirtualizingTilePanel background scrolling -

i'm trying create view looks bookshelf items sitting on shelf virtualization. able achieve adding virtualizingtilepanel class listview . class using dan crevier's blog here: http://blogs.msdn.com/b/dancre/archive/2006/02/16/implementing-a-virtualizingpanel-part-4-the-goods.aspx i adding virtualizingtilepanel , background listview this: <listview.itemspanel> <itemspaneltemplate> <local:virtualizingtilepanel> <local:virtualizingtilepanel.background> <imagebrush imagesource="..\images\bookshelf.png" alignmentx="left" alignmenty="top" tilemode="tile" stretch="none" viewportunits="absolute" viewport="0,0,319,203" /> </local:virtualizingtilepanel.background> </local:virtualizingtilepanel> </itemspaneltemplate> </listview.itemspanel> the problem have background fills original visible ar...

java - Encoding problems in database -

i have postgres 9.2 database, encoding utf-8. have application(written in java) update database, reading .sql files , executing them in database. found problem: in 1 of .sql files, have following instruction: insert usuario(nome) values('usuário padrão'); after executing this, when go table data, inserted this: "usuário padrão" if execute command directly pgadmin, creates correctly. don't know if it's problem in database, or in program executes scripts. ---edit--- here how jdbc connection: public static connection getconnection() throws sqlexception{ connection connection; string url="jdbc:postgresql://"+servidor+":"+porta+"/"+nomebanco; properties props = new properties(); props.put("user", usuario); props.put("password", senha); connection=drivermanager.getconnection(url,props); connection.setautocommit(false); return connection; } and here code use read...

java - throw error out of the program -

inside code have several throw statements: throws ioexception , urisyntaxexception , interruptedexception etc.). every time there errors, program stops running , exits. how can catch errors without closing program? you need implement try-catch block. imagine have method throws exception: public void somemethod() throws exception { throw new exception(); } to call method , handle exception, might this: try { somemethod(); } catch (exception e) { // handle exception here }

c++ - Hardcoding HLSL Shader -

i have shader written in hlsl not want user able access. there way can go compiling section of memory. problem following function accepts lpcstr in order use .fx file input: hresult d3dxcreateeffectfromfile( _in_ lpdirect3ddevice9 pdevice, _in_ lpctstr psrcfile, _in_ const d3dxmacro *pdefines, _in_ lpd3dxinclude pinclude, _in_ dword flags, _in_ lpd3dxeffectpool ppool, _out_ lpd3dxeffect *ppeffect, _out_ lpd3dxbuffer *ppcompilationerrors ); i need more along lines of void* or @ least way compile block of memory. other saving data file, compiling, , deleting file, there way this? wchar_t* shadercode = l"//poorly formatted shader code goes here"; i want able literally compile above section of memory. how can done? yes. d3dxcreateeffect function. creates effect ascii or binary effect description. http://msdn.microsoft.com/en-us/library/windows/desktop/bb172763(v=vs.85).aspx might check out d3dx10compilefrommemory.. ht...

c# - Grabbing the ID value from a drop down list in mvc -

the big picture this: when user logs in, can select "organization" log drop down list, has unique id # each organization. when user logs in, want grab id # people table. problem is, person in table twice, this: id name orgid 1 brandon 1 2 brandon 2 so, grab appropriate person id, need check against orgid also. here i've got in method: public actionresult index() { viewbag.organization = new selectlist(db.organizations, "orgid", "orgname"); return view(); } here post method: [httppost, actionname("submit")] public actionresult submitpost(string loginnid, string loginpassword, loginviewmodel model) { //create new instance of activedirectoryhelper access methods activedirectoryhelper login = new activedirectoryhelper(); //get username , password forms string username = loginnid; string password = loginpassword; int orgid = model.organiz...

c++ - segmentation fault in iterator of std::list -

class declarations struct cmp_str { bool operator()(char const *a, char const *b) { return std::strcmp(a, b) < 0; } }; class event_t { public: event_t(string *_session_time, string *_event_type, string *_table_name, string *_num_of_events); ~event_t(); char *table_name; char *event_type; pthread_mutex_t lock; pthread_cond_t cond; int num_of_events_threshold; double time_out; int num_of_events_so_far; }; std::map <char*, std::list<event_t*>, cmp_str > all_events; //global map i have function waits variable reach threshold done through pthread_cond , pthread_mutex. returns. last line gives segmentation fault. void foo(){ //don't worry event object ic created event_t *new_event = new event_t(args[0]->val_str(s),(args[1]->val_str(s)), (args[2]->val_str(s)), (args[3]->val_str(s))); map<char*, list<event_t*> >::iterator map_it; map_it = all_events.find(new_event->table_name); ...

python - @login_required is losing the current specified language -

i using i18n_patterns internationalize app , it's working except when click on link requires login (a view protected @login_required decorator), being redirected login form in default language instead of active one. how can preserve active url? in other words, when in french section, want @login_required redirect me /fr/login/?next=/fr/clients/ instead of /en/login/?next=/fr/clients/ i'm not well-versed in i18n django, don't think possible because login_required binds login_url parameter decorated function @ point of decorator application. you're better off writing own decorator; assuming don't use either of optional parameters login_required , can make own as from django.contrib.auth.views import redirect_to_login django.core.urlresolvers import reverse import functools def login_required(fn): @functools.wraps(fn) def _decorated(request, *args, **kwargs): if request.user.is_authenticated(): return fn(request, *arg...

c# - How to disable a checkbox in a DevExpress grid -

i have devexpress grid column shows checkbox. how can disable checkbox user not able click on it, still displays check or blank box? i suspect column boolean column . try setting column.columnedit textedit display true or false instead showing checkedit . by default boolean column uses checkedit in devexpress grid makes sense. note: i've not tested try out

c# - WIA Scanning throws exception while using ADF Scanner -

i using adf scanner library gideon ( http://adfwia.codeplex.com/ ) , have hit small problem. while can scan file throws exception when saving. i'll post full code: private void button1_click(object sender, eventargs e) { adfscan _scanner; int[] _colors = { 1, 2, 4 }; int count = 0; _scanner = new adfscan(); _scanner.scanning += new eventhandler<wiaimageeventargs>(_scanner_scanning); _scanner.scancomplete += new eventhandler(_scanner_scancomplete); scancolor selectedcolor = scancolor.color; // scancolor selectedcolor = (scancolor)_colors[combobox1.selectedindex]; int dpi = 300; _scanner.beginscan(selectedcolor, dpi); } void _scanner_scancomplete(object sender, eventargs e) { messagebox.show("scan complete"); } void _scanner_scanning(object sender, wiaimageeventargs e) {//e.scannedimage system.drawing.image int count = 0; string fi...

jruby - Ruby Shoes4 : how does Sample13 work? -

i rediscovered ruby shoes framework, tiny graphical framework, using ruby internal dsl capabilities, , more here shoes4 . one of examples (located in ./samples) impressed me in particular: sample13.rb , cannot understand. running example, canvas button named "new". each time push button, new figure (named box in program) added canvas (with random shape , color). more, can click these figures afterwards, , move them away. the code surprisingly short : shoes.app :width => 300, :height => 300 colors = shoes::colors = 45 button 'new' += 5 box = rand(2) == 0 ? rect(i, i, 20) : oval(i, i, 20) box.style :fill => send(colors.keys[rand(colors.keys.size)]) @flag = false box.click{@flag = true; @box = box} box.release{@flag = false} end motion{|left, top| @box.move(left-10, top-10) if @flag} end i explanations how code works. it seems each figure created stored somewhere, ? there means have access collection of newly...

javascript - Checkbox is not rendered properly -

i've been trying create base window class dialogs. creating controls decided override _createchildcontrolimpl method , use getchildcontrol method. , looks fine except checkbox. don't know why, checkbox not rendered if use getchildcontrol method. this code reproduce problem qx.class.define("mywin",{ extend: qx.ui.window.window, construct: function(t){ this.base(arguments, t); this.setlayout(new qx.ui.layout.canvas()); var row = new qx.ui.container.composite(new qx.ui.layout.hbox(5)); row.add(new qx.ui.basic.label("active:")); row.add(this.getchildcontrol("active")); row.add(new qx.ui.form.checkbox("status b")); var _maincontainer = new qx.ui.container.composite(new qx.ui.layout.vbox(5)); _maincontainer.add(row); this.add(_maincontainer, {width: "100%", bottom: 50, top:0}); }, members: { _createchildcontrolimpl : function(id, h...

java - I need help starting one method right after another method finishes, not during it -

i making game , after clicks, ball moves across screen takes time. trying method after ball stops moving. tried sleep , didnt work. looked @ asynctask , don't understand it. can point me in right direction or tell me how use asynctask code, thanks. new helpful. this first part main class has code actions in game. afterkick() method action want happen after kick() method finishes. final framelayout main = (framelayout) findviewbyid(r.id.main_view); main.setbackground(this.getresources().getdrawable(r.drawable.field)); newball = new ball(this); main.addview(newball); main.setontouchlistener(new view.ontouchlistener() { public boolean ontouch(view v, motionevent event) { float x = event.getx(); float y = event.gety(); system.out.println("x:" + x + " y" + y); if(kick == false && attempt<10) { setheight(y, newb...

r - How can I simplify a lattice xyplot with millions of data points? -

i have multiple sets of time history data collected @ approximately 500 hz 12 hours @ time. i've plotted data using xyplot type="l" on log time scale, phenomenon largely logarithmic decay. the resulting plots enormous pdf files take long time render , inflate file size of sweaved document, assume each individual data point being plotted, total overkill. plots reasonably reproduced orders of magnitude fewer points. switching type="smooth" fixes rendering , file size issue, loess smoothing drastically alters shape of lines, after toying loess smoothing parameters, i've given on loess smoothing option here. is there simple way either post-process plot simplify it, or sub-sample data before plotting? if subsampling data, think beneficial in sort of inverse-log way, data near 0 has high time frequency (use 500 hz source data), time goes on frequency of data decreases (even 0.01 hz more sufficient near t=12 hours)--this give more-or-less equal plo...

Debugging compile time performance issues caused by GHC's constraint solver -

haskell has many great tools debugging run time performance issues, tools/rules of thumb exist debugging compile time performance issues? specifically, constraint solver in of code taking forever (anywhere 1-2 seconds several minutes). i'm pretty sure due how i'm using type families in constraints, have no idea sort of things expensive in context or how see constraint solver spending time. best guess 1 of operations on type lists taking quadratic time instead of linear. let's see example of why suspect constraint solver. in files, have code looks like: class exampleclass type exampletype f :: exampletype -> data exampledata (xs :: [a]) = ... instance ( constraint1 , constraint2 , ... ) => exampleclass (exampledata xs) type exampletype (exampledata xs) = int f = undefined when load file ghci ghci> :l example.hs compilation happens quickly, less 1 second. then, execute following line: ghci> let tes...

c# - Remove selected item in combobox1 from the combobox2. (Comboboxes are bound from database.) -

i have 2 comboboxes named cbteam1 , cbteam2 (winform & c#) both bound same database table. if person selects team cbteam1 , want selected team not displayed in cbteam2 . private void bindcombobox() { if (con.state == connectionstate.closed) { con.open(); } string queryteam1 = "select * teams order team_name"; sqlcommand cmd = new sqlcommand(queryteam1, con); adapter = new sqldataadapter(cmd); adapter.fill(ds, "teams"); this.cboxteam1.selectedindexchanged -= new eventhandler(this.cboxteam1_selectedindexchanged); cboxteam1.datasource = ds.tables["teams"]; //if(cboxteam1.selectedindex cboxteam1.displaymember = "team_name"; cboxteam1.selectedindex = -1; cboxteam1.valuemember = "team_id"; this.cboxteam1.selectedindexchanged += new eventha...

sql - Simple Aggregation/ joining of tables -

i have 2 tables say, , b of account_numbers. b being subset of a. how join 2 tables such add additional field in output table common elements (here account_numbers) being flagged 1 , rest 0 table account_number 11 13 15 16 17 20 table b account_number 13 16 20 output table account flag 11 0 13 1 15 0 16 1 17 0 20 1 select account_number, count(*)-1 flag ( select account_number union select account_number b ) ab group account_number; checkout this demo . let me know if works.

Determining if a page is a static .aspx page or does not exist in the sitecore pipeline -

i'm working in sitecore pipeline on processor. need determine if request being sent static .aspx page not have context item or if page being requested not exist. this happen right after itemresolver process fires database set master both .aspx running through pipeline , request page doesn't exist. i can't check if context.item == null because static page has no item associated , i'd keep way since content on said page not changing. let me know if have ideas differentiate between these! you might able use sitecore.context.page.filepath . set layout on sitecore item (i.e. '/layouts/standard layout.aspx') while on static page it'll path page. if static pages in different location sitecore layouts might easy matching part of filepath .

java - Sorting algorithm with run error -

hey wanted excercise in java, reading .txt files filled numbers, , creating 1 numbres max min. in order made classes. code: import java.io.*; import java.util.linkedlist; public class texto { string filename; public texto(string nombrearchivo) { this.filename = nombrearchivo; } public linkedlist storearray() { linkedlist list = new linkedlist(); int a=0; try { filereader file = new filereader(filename); bufferedreader buffer = new bufferedreader(file); string temp=""; while (temp!=null) { list.add(buffer.readline()); temp=list.get(a).tostring(); // line 25 a++; } list.remove(a); } catch (ioexception e) { e.getmessage(); } return list; } public int getlength() { return storearray().size(); // line 41 } pub...

c# - Need help replacing parts of json string with regex -

how can replace following using regex.replace in c# application? replace of following: rendition\":{ with: rendition\":[{ so adding left square bracket. and also replace: \"}} with: \"}]} i using jsonconvert newtonsoft convert xml json. rendition element in xmls may or may not array. trying force converted json array replace: (?<=rendition:)\"\{(.*?)\"\}\} with: \"[{$1\"}]} in c#: string json2 = regex.replace(json, "(?<=rendition\\\\\":)\\{(.*?)\\}\\}", "[{$1}]}"); see live demo of c# code running on ideone.

#1062 - Duplicate entry '' for key 'unique_id' When Trying to add UNIQUE KEY (MySQL) -

Image
i've got error on mysql while trying add unique key. here's i'm trying do. i've got column called 'unique_id' varchar(100). there no indexes defined on table. i'm getting error: #1062 - duplicate entry '' key 'unique_id' when try add unique key. here screenshot of how i'm setting in phpmyadmin: here mysql query that's generate phpmyadmin: alter table `wind_archive` add `unique_id` varchar( 100 ) not null first , add unique ( `unique_id` ) i've had problem in past , never resolved rebuilt table scratch. unfortunately in case cannot there many entries in table already. help! the error says all: duplicate entry '' so run following query: select unique_id,count(unique_id) yourtblname group unique_id having count(unique_id) >1 this query show problem select * yourtblname unique_id='' this show there values have duplicates. trying create unique index on field duplicates. need r...

android - Circular Buttons in LinearLayout:Vertical -

Image
i have created own drawable object, setting background of image button. (described here ) <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#a7bf1d"/> </shape> i want these spaced equally vertically down side of screen, want use android:layout_weight achieve this. (described here ) <linearlayout android:id="@+id/left_bar" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="8"> <button android:id="@+id/btncall" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background=...

c# - From Sql to Linq-toSql -

i'm using sql server 2012 , .net 4 the sql i'd convert c# looks this: select rd.name, rd.description, prdv.value roledetail rd join role r on r.roleid = rd.roleid join personrole pr on pr.roleid = r.roleid left outer join personroledetailvalue prdv on prdv.roledetailid = rd.roledetailid pr.personid = 42 after several attempts , time wasted, don't seem better off when started. appreciated. i prefer method syntax, query syntax solutions more welcome too. solutions (thanks david b's answer below) below both working solutions. hope others can benefit... method syntax: var methodsyntax = db.personroles .where(pr => pr.personid == 42) .selectmany(pr => pr.role.roledetails) .selectmany(rd => rd.personroledetailvalues.defaultifempty(), (rd, prdv) => new { name = rd.name, description = rd.description, value = prdv.value }); query syntax: var querysyntax = pr in db.pe...

dms - How to get OpenERP's Document Management to save files on the file system? -

i'm running v7.0, , installed document management system. both before , after following these instructions have been unsuccessful in locating newly uploaded files in file system (i deleted , re-uploaded after change). also, when looking in ir_attachments table store_fname field blank. anyone know how openerp store files in file system on not in database? see antony lesuisse's explanation here .