Posts

Showing posts from July, 2014

php - Magento modify customer activation module for customer group -

i'm trying modify netzarbeiter's customer activation module extension flags customer group admin approval. following block of code have been modifying. /** * flag new accounts such * * @param varien_event_observer $observer */ public function customersavebefore($observer) { $customer = $observer->getevent()->getcustomer(); //$customer_group_id=$customer->getcustomergroupid(); $customer_group_id = mage::getsingleton('customer/session')->getcustomergroupid(); mage::log('the customer group id is'. $customer_group_id , null, 'caitlin.log'); if ($customer_group_id=1) mage::log('i have general group id \n',null,'caitlin.log'); else if ($customer_group_id=5) mage::log('i have test group id \n',null,'caitlin.log'); else mage::log('i dont understand! \n',null,'caitlin.log'); $storeid = mage::helper('customeractivation')->g...

php - Using TextBox in Email Template to Get User input -

i coding mailchimp template, have add text box in email template , 1 receives email enter value in text box , press send button in email, , entered value sent email address email, know how code mailchimp templates have no idea add textbox , gets value , send email account please guide me how it. you need create html form post or action sends data server, there can email value yourself. cannot rely on viewer's computer send email.

python - Making a custom probability distribution to draw random samples from in SciPy -

i'm looking sum arbitrary number of probabilistic distributions of things using montecarlo type simulation. i'd randomly sample continuous distributions of , add them other random samples of other continuous distributions, getting probability distribution combination. distributions empirical - aren't function in form of p99 = 2.4, p90 = 7.12, p50 = 24.53, p10 = 82.14 , on (in reality there bunch of points). distributions more or less lognormal, approximating them lognormal fine, if that's necessary. how enter scipy's lognorm function ? or other way in scipy, or python in general? i hope it's clear i'm trying do. lot, alex it looks have histogram of probability density. 1 thing can use inverse transform sampling empirical distribution. as alternative, if expect functional form of distribution (lognorm or other one), can try fitting data corresponding functional form.

matlab - Find an index position within a matrix -

in example have matrix (a) a = 1 2 3 7 0.9 0.6 0.2 0.2 0.8 17 72 15 my goal search through matrix , find index position of highest value not >= 72. matrix illustration know how matrix of dimension rows , columns equal (2x2 3x3 4x4 ...) in case calculate fact highest number within constraints rows=3 cols = 2 thanks step 1: determine value you're interested in. val = max(a(a<72)); step 2: find index of element corresponds value: [r,c] = find(a==val,1,'first'); #%only take first element (this can changed) #r row index, c column index you use linear indexing , ind2sub : l = find(a==val); #%this time, find elements meet criteria [r,c] = ind2sub(size(a),l); here links documentation find , ind2sub . don't have store value ( val ) of interest either, can put in 1 line.

javascript - how to use onClick() on checkbox in jsp page -

how use onclick() event within jsp page on checkbox. here code , keeps giving me errors when have onclick() event in code. js: function togglediv(tokencheckbox) { if (tokencheckbox.checked == true) { document.getelementbyid("cardno").style.display = "none"; document.getelementbyid("token").style.display = "block"; } else { document.getelementbyid("cardno").style.display = "block"; document.getelementbyid("token").style.display = "none"; } } jsp: html:checkbox property="returntoken" onclick="togglediv(this)" it should >> <input type="checkbox" onclick="togglediv(this)"> this wrong >> <html:checkbox property="returntoken" onclick="togglediv(this)"> even if jsp, way declare html remains same. could please explain how use <html:checkbox> ? regards,

c# - aggregation result from SQL view to gridview -

Image
i have view multi tables account_name.......bonus..........value customer1............a............14000 customer1............b............500 customer1............c............14500 customer2............a............20000 customer2............b............200 customer2............c............20200 http://im33.gulfup.com/nt0mm.png how can retrieval view , show on gridview view using linq ...................a.........b..........c customer1.......14000.......500.......14500 customer2.......20000.......200.......20200 select account_name, sum(case when bonus = 'a' value else 0 end) a, sum(case when bonus = 'b' value else 0 end) b, sum(case when bonus = 'c' value else 0 end) c youview group account_name

c# 4.0 - I'm looking for a particular insertion algorithm but I can't think of the name -

basically have method take set of numbers selected value , reorder them ascending keeping track of new selected value. so {21, 2, 9, 13} selectedval = 9 becomes { 1, 2, 3, 4 } selectedval = 2 what need able swap 2 numbers , keep order intact. if want swap 2 4 need 3->2 , 4->3 other way around swapping 3 1 1->2 , 2->3. i'm sure there proven algorithm , create own fun tomorrow i'd fastest solution use in actual application. the name of algorithm or useful links appreciated. using c# 4.0 if matters @ all. edit - came own solution believe works on paper i'd still reply if knows better solution. assuming ordered list starts @ 1 in case... if (newpos < currpos) (int = newpos-1; < currpos-1; i++) { array[i] += 1; array[currpos-1] = newpos; } else if (newpos > currpos) (int = newpos-1; >= currpos-1; i--) { array[i] -= 1; array[currpos-1] = newpos; } else // nothing since trying swap sa...

ruby on rails - rake assets:precompile failing without a useful error -

i'm trying precompile assets, whenever try fails error, doesn't tell me other have no idea it's coming or how find it. i'm running rake assets:precompile --trace , getting following output ** invoke assets:precompile (first_time) ** execute assets:precompile /home/nginx/.rvm/rubies/ruby-1.9.3-p327/bin/ruby /home/nginx/.rvm/gems/ruby-1.9.3-p327/bin/rake assets:precompile:all rails_env=production rails_groups=assets --trace ** invoke assets:precompile:all (first_time) ** execute assets:precompile:all ** invoke assets:precompile:primary (first_time) ** invoke assets:environment (first_time) ** execute assets:environment ** invoke environment (first_time) ** execute environment ** invoke tmp:cache:clear (first_time) ** execute tmp:cache:clear ** execute assets:precompile:primary undefined method `[]' nil:nilclass command failed status (1): [/home/nginx/.rvm/rubies/ruby-1.9.3-p327/bi...] that full output, i've not cut out. can see, i'm getting error no l...

android - Action bar overflow menu vs hardware permanent menu button -

i'd tested app on nexus 10 (android 4.2.1), , overflow menu on action bar worked fine. dumbfounded when overflow menu didn't appear on galaxy note 2. after reading android action bar not showing overflow , how control use of overflow menu in ics , realised on galaxy note 2 there's built in menu button, , "overflow menu" comes if 1 presses button. the responses 2 questions suggest 1 should not use code there disable permanent menu button, because although has effect of (a) making overflow menu appear in action bar, apparently (b) forces same behavior in other apps too. however, me overflow menu in action bar far superior menu button, , comments left on 2 questions suggest other people think too. my question is, possible use code disable permanent menu button in onresume(), , re-enable in onpause()? how reliable method make action bar overflow menu work in chosen app, other apps left unchanged? just record, seems me android designers (both software ,...

java - my soundpool project won't play properly? -

i've been trying implement soundpool class (with tutorial) when try run on virtual device, sound won't play... main_activity xml file loads fine, expected on loading, sound played. here source code. public class mainactivity extends activity { private soundpool soundpool; private boolean soundpoolloaded = false; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // create new soundpool instance. // 2 = number of sounds can simultaneously played // audiomanager.stream_music = type of sound stream. stream_music common 1 // 0 = sound quality, default 0. // setonloadcompletelistener loads file soundpool = new soundpool(2, audiomanager.stream_music, 0); soundpool.setonloadcompletelistener(new onloadcompletelistener() { @override public void onloadcomplete(soundpool soundpool, int sampleid, int status) { soundpoolloaded = ...

ios - UICollectionView displays cells incorrectly after frame change -

i noticed if change frame of uicollectionview (e.g. when toggling in-call status bar), collection view doesn't update cells new frame. it's easiest see in short video: http://cl.ly/2t2y2a3a2w1d/collectionviewtest.mov the source files simple test here: http://cl.ly/0s0a360b3i3q/collectionviewtest.zip it doesn't seem matter whether use uicollectionviewcontroller or uiviewcontroller. has seen this? missing something? workaround i've found call reloaddata on collection view in view controller's viewwilllayoutsubviews or viewdidlayoutsubviews works far ideal when collection view's frame being affected user drag since reloaddata called many times , results in sluggish ui updates while user dragging. i had similar problem, uicollectionview 's frame changed , unless call reloaddata got stuck in same spot without moving collectionview . i've fixed adding collectionviewflowlayout: - (bool)shouldinvalidatelayoutforboundschange:(cgrect)new...

ruby on rails - Paperclip::Errors::NotIdentifiedByImageMagickError on Windows 7 -

i'm going through mattan griffel's "one month rails" ( http://onemonthrails.com/ ) class. i'm trying use paperclip gem upload images. initial install , usage went fine, until added line reduce size of images. placed in app/models/pin.rb shown in tutorial: has_attached_file :image, styles: { medium: "320x240>" } it worked until styles: {} part added. have updated partial pass in :medium method. i'm using: paperclip (3.4.1),cocaine (0.5.1) , rails (3.2.12). have seen other posts fixed homebrew, i'm on windows 7 machine , i'm doesn't apply. let me know if need post else. i'm following same course. after several gem changes (trying older versions of cocaine, etcetera...) thing solved problem adding line pin.rb: paperclip.options[:command_path] = 'c:/program files/imagemagick-6.8.5-q16' before belongs_to :user (change path image magick install path) after this, run bundle update , reset rails s...

performance - Delphi procedure parameter: var is slower than pointer? -

i've got "send" routine in delphi 6 accepts variable-sized block of data (a fixed-size header followed varying amounts of data) , routine calls sendto() in winsock. i've coded 2 ways, once passed block var (somewhat misleading, works) , once pointer block passed. simple version used benchmarking looks like: type header = record destination, serialnumber: integer end; pheader = ^header; var smallblock: record h: header; data: array[1..5] of integer end; bigblock: record h: header; data: array[1..100] of integer end; procedure send1(var h: header; size: integer); begin h.destination := 1; // typical header adjustments before sendto() h.serialnumber := 2; sendto(sock, h, size, 0, client, sizeof(client)) end; procedure send2(p: pheader; size: cardinal); begin p^.destination := 1; p^.serialnumber := 2; sendto(sock, p^, size, 0, client, sizeof(client)) end; procedure doit1; begin send1(smallblock.h, sizeof(smallblock)); send1(bigblock.h, sizeof(bigblock...

concatenation - Concatenate character to a sentence c -

how add char sentence. for example have player1 , add player1 beginning of sentence " please enter how many times shuffle deck. i'm used java can add + concatenate variable , string(s) i have far doesn't of have typed: printf(&player1 + " please enter how many times shuffle deck: "); int numshuf; scanf("%i", &numshuf); any appreciated try this: printf("%s please enter how many times shuffle deck: ", player1); printf means print formatted, can format want print , add variables in arguments.

c# - OpenTK Picking sample crashing -

i going through opentk (opentk-2010-10-06.exe) sample code provided opentk installation. interested on picking example, crashes. other samples working. problem? come across problem. please help i couldn't post image here, exception opentk.graphics.graphicserrorexception this thread give answer (opentk.com/node/2913 ). if want develop sample/ or tryout picking mechanism, select redbook sample (from tao) , change opentk commands, simple , direct :-)

ScaleTo Error in a KINECT Project using Vb.Net -

i still looking solution problem ... i need solve project problem in scaleto() method code: dim scaledjoint = joint.scaleto(screenmaxx, screenmaxy, 0.5f, 0.2f) the error says " 'scaleto' not member of 'microsoft.research.kinect.nui.joint' " please need solution this... thx scaleto part of coding4fun kinect toolkit . not part of standard kinect sdk. also, microsoft.research.kinect.nui namespace represents old version of sdk. several major changes have accrued since release of sdk 1.5, , sdk 1.7. should not learning on such obsolete version of sdk.

java - creating array with elements determined by user/input -

trying make array, , want elements large input be. should take x amount of numbers, place in array, , return average. first need figure out how placing size of elements in array done. import java.util.scanner; import java.util.arraylist; //needs array public class statsv2 { public static void main (string args[]) { int[] a= new int[5]; scanner sc=new scanner(system.in); system.out.println("please enter numbers..."); for(int j=0;j<5;j++) { a[j]=sc.nextint(); } } } so want '5'(which appears twice) many times user keeps entering new numbers first of all, instead of j<5 , use yourarray.length . as array size, cannot done dynamically, have 3 options: 1) create array large enough user won't overrun it, you'll have checking in order stop @ end of user input. 2) use arraylist , can dynamically add to, call 'toarray()' when user done entering data extract arra...

c# - SSRS report won't launch if multiple parameters in URL -

i trying pass parameters ssrs report .net application. i have 3 parameters pass: instanceid, el , ol. in code-behind, have codes below: string params = session["instanceid"].tostring() + "&el=unhide&ol=unhide"; string script = "<script language='javascript'> "; script += "openlink1(" + params + ");"; script += "</script>"; page.registerstartupscript("clientscript", script); my javascript code below: function openlink1(params ) { var str = "http://server/reportserver/pages/reportviewer.aspx?%2f<path>%2f<report name>%2<report name>&rs:command=render&instanceid=" + params; window.open(str, "list", "scrollbars=yes,resizable=yes,width=800,height=600"); return false; } no matter do, report won't launch (pop up). the el , ol parameters supposed hide tables in ssrs rep...

SignalR and Hub Persistance -

i trying out signalr, , don't quite understand how call methods client in way calls same hub. i have 2 methods in hub: private ctldatamanager mymanager; public void startconnection() { mymanager = new ctldatamanager("test"); mymanager.updateitemevent += mymanager_updateitemevent; mymanager.connect(); } public void stopconnection() { mymanager.disconnect(); } and in client try call them this: var notificationhub = $.connection.notificationhub; $.connection.hub.start() .done(function (state) { $("#submit").click(function (e) { e.preventdefault(); notificationhub.server.startconnection(); return false; }); $("#stop").click(function (e) { e.preventdefault(); notificationhub.server.stopconnection(); return false; }); });...

Reading data from Simulink into Python over UDP -

i want send data simulink model (running in real time) python script (also running in real time. using simulink's built-in "udp send" block, works, don't know how decode data i'm getting. python script looks like: import sys, struct socket import * size = 1024 # packet size hostname = gethostbyname('0.0.0.0') mysocket = socket( af_inet, sock_dgram ) mysocket.bind((hostname,5002)) repeat = true while repeat: (data,addr) = mysocket.recvfrom(size) data = struct.unpack('d',data) print data i've suspected data stream should double, while it's giving me numbers aren't meaningful: if simulink sends constant "1", output of "3.16e-322" if simulink sends constant "2", output of "3.038e-319" any ideas? turns out network reversing packet bits. solution read in bit-reversed: data = struct.unpack('!d',data) i have no clue why happens on networks , not...

How to find object by multiple attributes in sahi for ruby -

in sahi controller, works fine _div({classname:"/class.*/",id:"id"}) but tried below in sahi ruby, returns false. @browser.div('{classname:"/class.*/",id:"id"}').exists? try now: assert @browser.div(@browser.eval('({classname:"class",id:"id"})')).exists this work.

javascript - MyFunction() Uncaught Reference error -

error: uncaught referenceerror: myfunction not defined this .js file isn't working or calling on html function = myfunction() { var ret = ""; (var = 15; < 26; i++) { ret += + " " + i*2 + " " + i*3 + "\n"; } alert(ret); } this html code: <!doctype html> <html> <head> <script type="text/javascript" src="test1.js"></script> </head> <body> <h1> exercise 4 - lab 4 </h1> <h2> exercise 2.1 </h2> <button type="button" onclick= "myfunction() "> press me </button> </body> </html> error: uncaught referenceerror: myfunction not defined here go: var myfunction = function () { var ret = ""; (var = 15; < 26; i++) { ret += + " " + i*2 + " " + i*3 + "\n"; } alert(ret); }; function = var...

android - Eclipse logcat input interrogation mark -

Image
my phone samsung galaxyiii android 4.1*. i connect pc check phone log . in eclipse input content interrogation mark '????' why happen?could me please. thank you.

Algorithm to show all combinations of numbers in the list -

how build recursive function show possibilities of signs in list of numbers e.g. (5, 3, 12, 9, 15). list won't change, signs each number. for example, results be: (-5, 3, 12, 9, 15) (-5, -3, 12, 9, 15) (-5, -3, -12, 9, 15) (-5, -3, -12, -9, 15) and on, until combinations of list displayed. i've tried few different ways, including trying adapt code other similar questions here, majority of them include changing list itself. thanks! when implementing recursive function, need think 2 cases: base case , recursive case. in base case, function doesn't call recursively. may work in case, or may nothing because work has been done. in recursive case, function little bit of work closer goal, calls recursively rest of work done. here's way break down problem recursive function. in recursive case, “little bit of work” setting sign of 1 number in list positive, , also set sign of number negative. need recurse after both assignments, because need ...

html - Menubar on site not centering after many tries -

i have menubar on site that's not centering. i've tried text-align:center everywhere, played around margins , position, can't seem text aligned main title regardless of screen size. guys mind taking look? http://jsfiddle.net/9sqkl/ <title>test</title> <link rel="stylesheet" type="text/css" href="style.css"> <link href='http://fonts.googleapis.com/css?family=lato:300,700' rel='stylesheet' type='text/css'> </head> <body> <h1 style="text-align: center;">test</h1> <div> <ul id="nav"> <li ><a href="#" style="color:rgb(56,162,188);">home</a></li> <li ><a href="#" style="color:rgb(123,176,26);">projects</a></li> ...

html entities - Decoding full text with PHP -

i have output need decoded, it's passed php page such: &lt;img src=&#039;http://freetopwallpaper.com/wp-content/gallery/puppy-pic/puppy wallpaper-hd-19.jpg&#039; class=&#039;blog-image&#039; /&gt;lorem ipsum dolor sit amet, consectetur adipiscing elit. morbi augue lorem, semper eget varius non, aliquam vel felis. aliquam erat volutpat. suspendisse pellentesque, ipsum sed vulputate consequat, ligula nisi tincidunt lacus, eget pretium sapien felis sed arcu. vivamus ligula leo, interdum in vestibulum eget, malesuada nec diam. mauris interdum metus vel purus dapibus non feugiat risus ultricies. morbi semper convallis purus @ varius. mauris et lacinia lorem. quisque id lacus sem cartomizer. &amp;lt;strong&amp;gt;proin facilisis lacus in nisi laoreet rutrum. praesent ligula magna, interdum gravida egestas a, posuere @ ante. sed est neque, rhoncus et mattis in, cursus @ risus. sed in quam purus. mauris vitae dui est, quis consequat lacus. proin molli...

socialengine integration with external php website -

i using social-engine social-networking website , @ same time having website done in php codeingiter mvc. want integrate social-engine our website. using social-engine db our php website. when log our website should automatically logged social-engine also. don't know start from? there anyway it? probably should create custom login action (default login action in application/modules/user/controllers/authcontroller.php) , launch using ajax, way not because might unpredictable problems session or else. better way create login action launched user. user click button (like facebook or twitter login buttons) , launch custom login action using data php website, logged in.

Not getting full http response in android -

i try json data ulr . i testing url in firefox poster add-on work fine ,getting full response . but in android not getting full http response . this code httpclient client = new defaulthttpclient(); httpconnectionparams.setconnectiontimeout(client.getparams(), 10000); // timeout // limit httpresponse response; jsonobject json = new jsonobject(); try { httppost post = new httppost(api.all_property_buy); /* * json.put("fid", fname); json.put("fid", lname); */ stringentity se = new stringentity(json.tostring()); se.setcontenttype(new basicheader(http.content_type,"application/json")); post.setentity(se); response = client.execute(post); /* checking response */ if (response != null) { inputstream in = response.getentity().getcontent(); // // data in ...

php - My own SQL syntax error -

my code is. $newmodel = "insert models (id," . " firstname," . " lastname," . " email," . " password," . " group," . " phone," . " timeofday," . " dayofweek," . " address," . " city," . " state," . " zip," . " gender," . " hair," . " eye," . " birthday," . " birthmonth," . " birthyear," . " bustshirt," . " cup," . " waist," . " hips," . " waist," . " hips," . " weight," . " inches," . " dressjacket," . " workxp," . " twitter," . " facebook," . " joindate," . " instagram," . " imdb," . " parentid," . ...

c# - Check if a string is a valid date using DateTime.TryParse -

i using datetime.tryparse() function check if particular string valid datetime not depending on cultures. surprise , function returns true strings "1-1", "1/1" .etc. how can solve problem? update: does mean, if want check if particular string valid datetime, need huge array of formats?? there different combinations , believe. even there lots of date separator ( '.' , '/' , '-', etc..) depending on culture, difficult me define array of format check against . basically, want check if particular string contains @ least day(1 through 31 or 01 through 31),month(1 through 12 or 01 through 12) , year(yyyy or yy) in order, date separator , solution? so, if value includes parts of time, should return true too. not able define array of format. if want dates conform particular format or formats use datetime.tryparseexact otherwise default behaviour of datetime.tryparse datetime.tryparse this method tries ignore unrecog...

Virtual Memory in Visual C++ -

i have query regarding virtual memory. first of all, mention new field of programming. have read on visual memory. now have program opens softwares require large amounts of memory (like example picture viewer). concerned computer, however, cannot spare of memory . , done visual c++. picture viewer running on physical memory. but once software distributed, used on computers cant spare of physical memory. task research , find out how switch program using physical memory virtual memory. in end implementing myself. so question is, how alter code in such way can prevent application using physical memory , instead, switch on virtual memory? i'm not asking provide me copy paste code ofcourse, method so. also, if explain logic behind it , appreciate it. loads of in advance. the operating system in charge of deciding should stored in ram , should paged out vm. under abnormal circumstances, can useful can provide advice os app, recommended experts. novice, best bet tr...

Small confusion in regex at | (pipe) -

when use pattren "(see|see also) [\w\d]+" on text see page see page but output matches is see page see if im interchanged see, see also "(see also|see) [\w\d]+" the output see page see page i thought both same. may know why happen? removing alternation , leaving see [\w\d]+ match string "see page" because satisfied see also . way regular expressions work alternation (at least in case) attempt match each option in order rest of pattern , stop successfully, or go alternatives when fails. when reverse alternation, tries match see also first, fail "see page." it make more sense write see( also)? [\w\d]+

android - Capture Image while Device is Locked with Password -

i want implement functionality capture image through front camera when tries unlock device , enter incorrect password 3 times. checked possible in android , applications available in market. i have done work achieve getting black image. here's code : register device admin broadcast incorrect password attempt : public class deviceadminsample extends deviceadminreceiver { static context ctx; static sharedpreferences getsamplepreferences(context context) { ctx = context; return context.getsharedpreferences( deviceadminreceiver.class.getname(), 0); } @override public void onpasswordfailed(context context, intent intent) { super.onpasswordfailed(context, intent); system.out.println("password attempt failed..."); intent = new intent(context, cameraview.class); i.setflags(intent.flag_activity_new_task); context.startactivity(i); } } camera class capture image , save sd card : public class cameraview extends activity ...

ruby on rails 3 - Bootstrap (2.3.1) + SimpleForm (2.1) inline label for radio button group -

i'm trying create inline radio buttons has label inline (at left). as state in title, using bootstrap , simpleform. my code looks this: <%= f.input :breakdown_or_size, :collection => ["breakdown", "manual"], :as => :radio_buttons, :item_wrapper_class => 'inline', :label => 'select one: ' %> this get: radio buttons below label http://www.webpagescreenshot.info/i3/516f8dbc4c7633-60839289 i looked high , low simple_form_for help. in end couldn't find anything, @ least form_for can this: <%= form_for(@book) |f| %> <% if @book.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@book.errors.count, "error") %> prohibited book being saved:</h2> <ul> <% @book.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul...

android - Constant and probably inaccurate Frame Rate -

i using following code calculate frame rate in unity3d 4.0. it's applied on ngui label. void update () { timeleft -= time.deltatime; accum += time.timescale/time.deltatime; ++frames; // interval ended - update gui text , start new interval if( timeleft <= 0.0 ) { // display 2 fractional digits (f2 format) float fps = accum/frames; string format = system.string.format("{0:f2} fps",fps); fpslabel.text = format; timeleft = updateinterval; accum = 0.0f; frames = 0; } } it working previously, or @ least seemed working.then having problem physics, changed fixed timestep 0.005 , max timestep 0.017 . yeah know it's low, game working fine on that. problem above fps code returns 58.82 time. i've checked on separate devices (android). doesn't budge. thought might correct, when saw profiler, can see up...

Display a link and by clicking on that all the new products should be displayed like category view page in Magento -

i displaying new products on homepage through widget. displaying 3 new products on homepage. want put link under products display. clicking on link, products should displayed in separate page. give href of link?? try creating cms page new products admin , on href give link page.

ios - populating a tableview with nsmutabledata received from a webservice -

i populate tableview nsmutabledata received webservice. can data , display @ several components cannot fill tableview because following code doesn't accept nsmutabledata ; anynsarray = [nspropertylistserialization propertylistwithdata: webdata options: 0 format:&plf error: &error]; //webdata nsmutabledata populate webservice data , anynsarray nsarray provide tableview @ - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath here tableview populating blocks (also following code works @ view loads not fired again after click button): - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsstring *cellidentifier = [nsstring stringwithformat:@"cell%i",indexpath.row]; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuse...

How to keep only the LAST value of each pair in excel VBA? -

Image
contract no price d/019/09 17.85 d/019/09 17.85 d/019/09 17.85 d/019/09 17.85 d/023/09 17.85 d/023/09 17.85 d/026/09 0 d/026/09 0 d/038/11 20.6 d/038/11 20.6 d/038/11 20.6 the above example data series ... , keep last occurence of each unique contract no. in above example, keep d/023/09 17.85, d/026/09 0 , d/038/11 20.6. there should 3 unique values. efficient way it? further comment here way, doesn't need data sorted . see example of d/019/09 =if(countif($a2:$a$13,a2)>1,0,b2)

multidimensional array - Referring to variable in Java? -

i have 3d array called em : double[][][] em = new double[4][4][4]; i have helper method converts int to char : public static char inttochar(int i) { switch (i) { case 0: return 'a'; case 1: return 'b'; case 2: return 'c'; default: return 'd'; } } i have 4 integer variables: int = 108; int b = 299; int c = 302; int d = 411; now, here tricky part. want go through each index of 3d array em , multiply index values. [0][0][0] = 1*1*1 = 1; [0][0][1] = 1*1*2 = 2; ...; [3][3][3] = 4*4*4 = 64 . for (int i=0; i<4; i++){ (int j=0; j<4; j++){ (int k=0; k<4; k++){ char = inttochar(i); char j = inttochar(j); char k = inttochar(k); // not sure here } } } how can that? you need able refer a...d index, need index them in array: int[] d = {a, b, c, d}; which goes before loop. loop easy: em[i][j][k] = d...

angularjs - Naming Angular directives (ng- vs data-ng-) -

what recommended practice labelling angular directives? other html validation, there other benefits prefixing both in-built , own custom directives " data- "? or unnecessary clutter? i data- best practice. since allow html validate, should standard practice developers. may cause bit of clutter, overall think helps maintain intergrity of app , of developer. , seeing doesn't matter angular can tell far, there no reason not use data-.

Every user is a new thread JSF - JBOSS and creates new connection in MongoDb -

i'm trying work mongodb. created in jsf application scoped bean (with cdi). @named("appmongo") @applicationscoped public class mongoapplicationscope implements serializable{ private static final long serialversionuid = 1l; private db db = null; private mongoclient mongoclient = null; @postconstruct public void init() { try { mongoclient = new mongoclient("localhost", 27017); db = mongoclient.getdb("mydb"); } catch (unknownhostexception e) { e.printstacktrace(); } } public db getdb() { return db; } public dbcollection getcollectionindatabase(string collection) { dbcollection coll; coll = db.getcollection(collection); return coll; } public mongoclient getmongoclient() { return mongoclient; } } then create request scoped bean using prevoius bean. @named("mongobean") @requestscoped public class mongobean implements serializable { private static final long serialversionuid = 1l; @inject mongoapplications...

memory - Post-linker assembly code in GCC -

i compiling c-programs elf32-bigmips assembly code, , have managed assembly output using following commands (for example program using o1). mips-elf-gcc -o1 -c -g fib.c mips-elf-objdump -d -s -m no-aliases -j .rodata -j .text -j .bss -j .data fib.o > fib-o1.asm however, gives me assembly code linking part missing. using constant arrays data in code, , these arrays references in assembly code if starting @ memory location 0, i.e. no memory address offsets! suspect because linker information missing? how can post-linker assembly code correct memory referencing? thanks the -c option means compile , assemble, not link . remove if want link object code executable, , run objdump .

jquery mobile - Jquerymobile redirect to previous page -

i have page listview records binded database , button add new record. when click add button redirect next page. i create new record , on save again redirecting previous page with. but list view not showing records after redirecting. i redirecting this $.mobile.changepage("../../actuals/material", { transition: "slide", reloadpage: true, reverse: true, data: query }); listview binding data it's not showing. any help?

c# - what is a good refrence for a new person in asp mvc? -

i new in asp.net mvc3 .i need refrence read.what can be? have worked asp web forms want use asp mvc3 in vs2012. helps. isn't site enough?! see here: asp.net/mvc

c# - How do I load multiple XML files and read them? -

i've problem. in code i'm looking xml files in 1 directory. works don't know how read them. single 1 loaded string xmlfile. think need replace or edit in way code xmlfile not 1 file, files found in directory. what should doing? namespace windowsformsapplication11 { public partial class form1 : form { private const string xmlfile = "c:\games\games.xml"; // single xml file works public form1() { this.initializecomponent(); this.initializelistview(); this.loaddatafromxml(); listview.items.addrange(directory.getfiles("c:\games\", "*.xml") .select(f => new listviewitem(f)) .toarray()); } private void loaddatafromxml() { if (file.exists(xmlfile)) { xdocument document = xdocument.load(xmlfile); if (document.root != null...

How to validate checkbox group in PHP -

hi im struggling problem, can 1 help? got series of check boxes dynamically populated. line looks below part of while loop. echo "<td class='brc'><input type='checkbox' name='delz[]' value='$wec' ></td>"; when validating i'm finding difficult see at-least once check box check in loop. got following work, identifies vise versa need. how change give me output when nothing checked message echo saying 'nothing checked'? $selectboxes = $_post['delz']; foreach($selectboxes $a) {if($selectboxes == ""){echo "some check boxes selected !!!"; return;}} deselected checkboxes not passed through html forms. therefore: $checkboxesselected = isset($_post['delz']); if ($checkboxesselected) { echo "some check boxes selected"; } else { echo "no check boxes selected."; } should work.

Eclipse shutdown when creating unsigned android apk -

i'm freaking out eclipse, can generate unsigned apk. when start generating it, looks goes good, @ last moment when should finished generating unsinged apk eclipse shutdown suddenly. the weird thing in moments after try few times generate correctly, can't this, trying , trying every time. anyone have idea going on here? i have issue when generating signed apks. works me: uncheck "build automatically" (under project menu me, i'm on ios), clean project, make build.

android - Is there a way to render/show pdf in my tablet application? -

i implementing tablet application @ left side shows list of pdf files , on right side want show pdf file data. how can that? curious if launch pdf reader intent in fragment launch application on own. possible? or if should use pdf render sdk,but problem need avoid gpl license, , these kind of sdk, found gpl licensed,in mobile version open installed pdf reader. or can open them in webview? url place in file system. you can use android-pdf-viewer-library . able display pdfs in fragments or whatever use. although should @ source, , you'll maybe have modify it, take care of asynktasks running "decode" pdf files, , stop them properly. you can't integrate/start external application via intent , encapsulate in activity or fragment .

allegrograph - Sparql - Concatenation fails if any one variable is not bound -

Image
hi using allegrograph , sparql query retrieve results. sample data reproduces issue. consider below data person has first, middle , last names. <http://mydomain.com/person1> <http://mydomain.com/firstname> "john"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#xmlliteral> <http://mydomain.com/person1> <http://mydomain.com/middlename> "paul"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#xmlliteral> <http://mydomain.com/person1> <http://mydomain.com/lastname> "jai"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#xmlliteral> <http://mydomain.com/person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mydomain.com/person> <http://mydomain.com/person6> <http://mydomain.com/middlename> "mannan"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#xmlliteral> <http://mydomain.com/person6> <http://mydomain.com/lastname> "sathish"^^<http:/...

javascript - How does Google hide HTML source of search results? -

when try view source code of google search results page see bunch of javascript code instead of readable text. how google that? i have searched through web couldn't find explanation, thing found this: http://goo.gl/fivd6 , not helpful. i not web developer got curious. brief explanation nice. thanks. google builds dom javascript noted. number of reasons: decrease load on server generate each dynamic result set html markup. google returns results in json feed ( example ) - pastebin. less processing power required produce json response full html snippet or new page speed. assuming user has decent internet connection, speed of pages rendering on client side compared server side negligible. as suggested above, jump firebug , have around :)

php - How to include page title of wordpress post in the content possibly with a shortcode -

in wordpress admin, following when creating page: page title: test page content: lorem ipsum dolor [page_title] sit amet, consectetur adipiscing elit. nunc et lectus sit amet ante vulputate ultrices @ sit amet [page_title] tortor. nam mattis commodo mi in semper. suspendisse ut eros dolor. morbi @ odio feugiat [page_title] nunc vestibulum venenatis sit amet vitae neque. nam ullamcorper ante ac risus malesuada id iaculis nibh ultrices. where says [page_title] print page title (test) this needs achieved through admin system, not hard-coded in template. refer codex: shortcode api function myshortcode_title( ){ return get_the_title(); } add_shortcode( 'page_title', 'myshortcode_title' ); add theme's functions.php file.

mongoose - how to get the matching document inside a array in mongodb? -

my collection this { _id :"", name:[ { firstname:"", lastname:"", } ] } i need find matching firstname in documents. how achieve in query ? new mongodb. db.collection.find({name: {$elemmatch: {firstname: "raj"}}}); for further details check out documentation $elemmatch