Posts

Showing posts from July, 2015

Rails validations using errors.add -

Rails validations using errors.add - i have separate method in model validate this: validate :validate_id def validate_id errors.add(:base, "id should not blank") if self.project_id.blank? end i need perform validation this: validates_format_of :project_id, :with => /^(?!\d+$)[a-z0-9-_]*$/ which validate letters , numbers underscore , dash , no spaces between them. is there possible way utilize in method validate_id. thanks in advance try: def validate_id errors.add(:base, "id should not blank") if /^(?!\d+$)[a-z0-9-_]*$/.match(self.project_id).nil? end ruby-on-rails ruby-on-rails-3

linux - bash script to get files from a dir and compare them with another dir -

linux - bash script to get files from a dir and compare them with another dir - suppose have dir1 files ( t1.txt, t2.txt, t3.txt) how can list of files name in bash script allows me compare list of files in dir2 , find missing files without using rsync diff -r --brief dir1 dir2 will tell differences between 2 directories, including when 1 directory contains file other 1 doesn't. incidentally, tell if dir1 , dir2 both contain files same name, t1.txt, different contents. won't print files same between 2 directories. linux bash centos ls

WSO2 API Manager with HMAC Authentication -

WSO2 API Manager with HMAC Authentication - does know how add together hmac based authentication wso2 api manager? background - we're rolling out wso2 api manager 1.3 in front end of our publicly available web services , need javascript applications (once authenticated) able consume services straight (not via service proxy on server handle oauth authentication). does know easiest way implemented in wso2? we've started implementing abstracthandler , authenticator seems overkill - must have done or have pointers on this? thank much in advance. you can write own handler can implement abstracthandler . signature verification can implemented api handler similar 'apiauthenticationhandler'. access token provided before can used mac identifier. consumer secret can used mac key, shared secret between consumer , provider used sign normalized request string. wso2

java - Get request parameter with Play Framework? -

java - Get request parameter with Play Framework? - i learning play framework , understand can map request such /manager/user as: /manage/:user controllers.application.some(user:string) how map request /play/video?video_id=1sh1 ? you have @ to the lowest degree 2 possibilities, let's phone call them approach1 , approach2 . in first approach can declare routes param default value. 0 candidate, easiest build status on top of it. it's typesafe , , pre-validates itself. recommend solution @ beginning. second approach reads params straight request string need parse integer , additionally validate if required. routes : get /approach1 controllers.application.approach1(video_id: int ?=0) /approach2 controllers.application.approach2 actions: public static result approach1(int video_id) { if (video_id == 0) homecoming badrequest("wrong video id"); homecoming ok("1: display video no. " + vide...

ios - optimize animation in cocos2d failed -

ios - optimize animation in cocos2d failed - when didn't optimize animation,it worked well.but when optimized animation,the programme crashed.and xcode log said: assertion failure in -[ccspritebatchnode addchild:z:tag:], /users/hanpengbo/documents/xcode/cocos2d_helloworld/cocos2d_helloworld/libs/coco‌​s2d/ccspritebatchnode.m:183 in ccspritebatchnode.m:183,there is nsassert( child.texture.name == textureatlas_.texture.name, @"ccsprite not using same texture id"); here code // cache ccspriteframecache *cache=[ccspriteframecache sharedspriteframecache]; [cache addspriteframeswithfile:@"birdatlas.plist"]; // frame array nsmutablearray *framesarray=[nsmutablearray array]; (int i=1; i<10; i++) { nsstring *framename=[nsstring stringwithformat:@"bird%d.png", i]; id frameobject=[cache spriteframebyname:framename]; [framesarray addobject:frameobject]; } // animation object id ani...

php - Get value and increment by one for each user -

php - Get value and increment by one for each user - i have script cron job set run every 5 mins, problem not increment energy level believe should. if can tell me doing wrong here great. remember, returns no errors, doesn't work, database connect info correct, left out of post. { $energy = mysql_query("select energy members id=$id"); //get current users energy level $energy_max = mysql_query("select energy-max members id=$id"); //get current users maximum energy level if ($energy < $energy_max) // -if current energy level less maximum { $energy = $energy ++; //increment energy 1 mysql_query("update members set energy= $energy"); //set new energy level } $id++; //increment next user } you can solve within single statement update `members` set `energy` = `energy` + 1 `energy-ma...

Create NuGet Package Dependency on MyGet Feed -

Create NuGet Package Dependency on MyGet Feed - i've got public nuget bundle has prerelease version depends on aspnetwebstacknightly feed on myget. know if there's way create dependency in bundle on feed? haven't been able find helpful. i'm guessing there's no way this, want seek lastly resort. :) you can have dependency defined in package. issue when force yours nuget.org without dependency beingness nowadays there, bundle consumers have configure myget feed dependency resolved during install time. more precisely, myget feed should set below nuget.org feed, , bundle should installed using "all" aggregate bundle source. you communicate in bundle readme.txt or in bundle metadata have visible on nuget.org bundle details page. seek add together powershell scripts , seek find way around it, issue you're fighting design. however, not recommend doing of this. basically, you'll have issue long dependency has not been pus...

c++ - MFC app to Linux dll -

c++ - MFC app to Linux dll - currently have legacy client/server scheme written in mfc(server) , java(client). scheme cant not run on net because of various reason. so, developing little scheme (very few functionalities of legacy system) in cake php etc fullfill client requirement. now, 1 functionality in legacy scheme needs in new system. thinking of making dll of code , integrate cake php (to save time) dll not work on linux new scheme sit. so, there way generate dll works php in linux scheme using qt etc? or we have rewrite whole thing? in case, appropriate framework develop cross platform dll. prefer utilize windows write it. also, can run dll cake php? thanks so, there way generate dll works php in linux scheme using qt etc? no, linux doesn't back upwards dll file format. may want compile shared object file in elf format source code. c++ linux cakephp dll mfc

regex - Regular Expression with Split in VB.NET -

regex - Regular Expression with Split in VB.NET - i want utilize split , regular expressions separate special codes in line. line: 14s15t3c16w17a0-20m0-7t now want separate out each item, , items e.g. 14s, 15t, 7t, etc. consists of random length of digits , 1 single alphabet after digit: e.g.: 125125125125125x or 11t. there exception 0- , these remain are, , must separated out too. i have made regular look myself: dim digits() string = regex.split(line, "([0-9][a-z]|0-)") but problem takes 1 digit of combination, example, if line 11t2b13d, separate this: 1, 1t, 2b, 1, 3d how can solve problem? since there single alphabet character or slash - (for case of 0- ) ends each token, can split using regex.split regex: (?<=[-a-za-z]) (?<=pattern) zero-width (text not consumed) positive look-behind, , match if text before current position matches pattern inside. the regex above checks character before current position alphabet (...

java - Detection of screenshot taken? -

java - Detection of screenshot taken? - is there way can observe in service when user takes screenshot of android device? the basic thought whenever user takes screenshot of device popup displayed asking user upload image facebook, twitter etc. this untested, may want seek fileobserver class. point @ screenshots folder , wait create event. https://developer.android.com/reference/android/os/fileobserver.html java android screenshot

jquery - Javascript decodes encoded string automatically? -

jquery - Javascript decodes encoded string automatically? - i've been reading blog post , saw says js encoding vulnerability. in sample code below, if user enters : \x3cscript\x3e%20alert(\x27pwnd\x27)%20\x3c/script\x3e , says js render html looks odd me. tried , right. @{ viewbag.title = "home page"; } <h2 id="welcome-message">welcome our website</h2> @if(!string.isnullorwhitespace(viewbag.username)) { <script type="text/javascript"> $(function () { //viewbag.username value comes controller. var message = 'welcome, @viewbag.username!'; $("#welcome-message").html(message).hide().show('slow'); }); </script> } my question is, why javascript decodes encoded string automatically? or have jquery's html() function that? op says utilize ajax.encodejavascriptstring() method in order solve problem. why need encode encoded string? checked jquery's webs...

android - how add search in actionbar sherlock -

android - how add search in actionbar sherlock - i using actionbar sherlock. want add together search alternative actionbar , intent edittext search other activity. can help me? do this @override public boolean oncreateoptionsmenu(menu menu) { //used set dark icons on lite action bar //create search view final searchview searchview = new searchview(getsupportactionbar().getthemedcontext()); searchview.setqueryhint("search"); menu.add(menu.none,menu.none,1,"search") .seticon(r.drawable.abs__ic_search) .setactionview(searchview) .setshowasaction(menuitem.show_as_action_always | menuitem.show_as_action_collapse_action_view); searchview.setonquerytextlistener(new onquerytextlistener() { @override public boolean onquerytextchange(string newtext) { if (newtext.length() > 0) { // search } else { // when there's no input ...

c# - Unable to find control in BottomPagerRow of GridView -

c# - Unable to find control in BottomPagerRow of GridView - i have simple application has gridview. have custom bottompagerrow using drop downwards list , link buttons. if effort utilize controls while default pages showing works fine, if alter page size other changes forces default. just looking @ code myself, can think because row number changing id of controls changing , when server attempts find them no longer exist , switch default. <asp:gridview id="dgcqmain" runat="server" enableviewstate="false" pagersettings-position="bottom" onpageindexchanging="dgcqmain_pageindexchanging" autogeneratecolumns="true" onrowcreated="dgcqmain_rowcreated"> <headerstyle cssclass="gridheaderrow" /> <alternatingrowstyle cssclass="gridalternatingrows" /> <pagerstyle cssclass="gridpager" /> <rowstyle cssclass="gridrow" /> <selec...

php - Google Docs Form Formkey in 2013 Custom Google Form -

php - Google Docs Form Formkey in 2013 Custom Google Form - hello i'm trying develop curl php send google form through php first , redirect landing page. issue lies within old google formkey response. before view form source , have formkey id number insert php script. here script sample: //google form key $formkey = "where formkey"; $thankyou = "http://www.eksenaevents.com/submission-successful/"; //change url google form address $googleformurl = "https://docs.google.com/forms/d/1pcihfvau8kur_j1gsax2wegcdrgjnh0merdeinbwd- 0/viewform"; //----------------send form fields google-------------------- //loops through form fields , creates query string submit google foreach ($_post $var => $value) { if ($var != "ignore") { $postdata=$postdata . htmlentities(str_replace("_", "." , $var)) . "=" . $value . "&"; } } //remove comma $postdata=substr($postdata,0,-1); //submit form fields ...

c# - How implement own HashSet contains method -

c# - How implement own HashSet contains method - i have hahset collection of int[9] arrays , want know if hashse contains array. example hashset<int[]> set = new hashset<int[]>(); int[] a=new int[9]{1,2,3,4,5,6,7,8,9}; set.add(a); int[] a2=new int[9]{1,2,3,4,5,6,7,8,9}; if(!set.contains(a2)) set.add(a2); how can override or implement own equals method hastset.contains behave arrays.sequenceequals? you need provide implementation of iequalitycomparer<int[]> , , utilize constructor takes custom comparer: class myeqcmpforint : iequalitycomparer<int[]> { public bool equals(int[] a, int[] b) { ... } public int gethashcode(int[] data) { ... } } hashset<int[]> set = new hashset<int[]>(new myeqcmpforint()); c#

c# - What happens to timer in standby mode? -

c# - What happens to timer in standby mode? - i'm using timer timers namespace. happens timer when pc goes sleep or hibernates? i have timer set 6 hours delay. what happen in situations. 1) timer starts @ hr 0 , goes sleep/hibernation immediately. pc wakes @ hr 5. timer fire after next 1 hr or after next 6 hours? 2) timer starts @ hr 0 , goes sleep/hibernation immediately. pc wakes @ hr 7. timer fire pc wakes or "miss" 1 time , fire in next 5 hours? start counting till next event time of pc waking or previous "missed" event? ok. asked friend , resutls: 23:21:32 : timer started 23:21:35 : pc goes sleep 23:22:50 : pc wakes 23:22:50 : timer fired 23:23:50 : timer fired using system; using system.collections.generic; using system.text; using system.threading; namespace test { class programme { static system.timers.timer timer; static void main(string[] args) { timer = new system.timers.timer...

ruby on rails - Can't pass project.id from view to controller -

ruby on rails - Can't pass project.id from view to controller - i want pass current project's id tickets controller (creating ticket project), seek below. however, way below gives me next link: tickets/new?project_id=8 ...when want way: tickets/new ...even though want project_id accessible in controller. how can this? clearify: don't want project_id part of url, want pass (in way) parameter controller. from view: <h1><%= @project.title %></h1> <-- project's attributes reachable here <%= link_to "create ticket", new_ticket_path(:project_id => @project.id), :class => "btn edit_button" %> tickets controller: 1. class ticketscontroller < applicationcontroller 2. def new 3. @ticket = ticket.new 4. @id = params[:project_id] 5. 6. @project = project.find(@id) 7. end 8. end the route link_to points looks following: new_ticket /ti...

iphone - Facebook Ios sdk logging in -

iphone - Facebook Ios sdk logging in - i trying create function ios facebook sdk able login , if logged in able see nslog string "logged in". not seeing string @ all. also, login seems working fine in terms of pushing button , seeing facebook app , pressing ok continue. can inform me on doing wrong? -(ibaction)popbutton:(id)sender { tuappdelegate *appdelegate = (tuappdelegate *)[[uiapplication sharedapplication] delegate]; // button's job flip-flop session open closed if (appdelegate.session.isopen) { // if user logs out explicitly, delete cached token information, , next // time run applicaiton presented log in ux again; // users close app or switch away, without logging out; // cause implicit cached-token login occur on next launch of application [appdelegate.session closeandcleartokeninformation]; } else { if (appdelegate.session.state != fbsessionstatecreated) { // create new, logged out session. appdelegate.ses...

javascript - How to provide data to Fuel UX datagrid from Rails? -

javascript - How to provide data to Fuel UX datagrid from Rails? - i'd utilize fuel ux datagrid display info retrieving database. page served ruby on rails server. the javascript illustration code building info object: var datasource = new staticdatasource({ columns: [{ property: 'toponymname', label: 'name', sortable: true }, { property: 'countrycode', label: 'country', sortable: true }, { property: 'population', label: 'population', sortable: true }, { property: 'fcodename', label: 'type', sortable: true }], data: sampledata.geonames, delay: 250 }); $('#mygrid').datagrid({ datasource: ...

javascript - IE doesn't support file upload in a dynamic form? -

javascript - IE doesn't support file upload in a dynamic form? - if explicitly write out form in html this: <form action='upload_1-img.php' enctype='multipart/form-data' method='post'> <input type='file' id='image' name='image'><input type='submit'> </form> then goes expected in ie. if following, works in chrome , ff not in ie8: <html> <head> <script> $(document).ready(function(){ imgform = document.createelement('form'); imgform.id = 'imgform'; imgform.method='post'; imgform.enctype='multipart/form-data'; imgform.action ='upload_1-img.php'; $('body').append(imgform); $('#imgform').append("<input type='file' id='image' name='image' /><input type=submit>"); }); </script> </head> <body> </body> </html> in ca...

android - MediaFormat required for Mediacodec -

android - MediaFormat required for Mediacodec - i trying decode h264 file using media codec. not straight supported android, configuring own decoder. i've attempted follow. codec = mediacodec.createdecoderbytype("video/avc"); format.createvideoformat("video/avc", /*640*/320, /*480*/240); seek { codec.configure(format, null, null,0); } catch(exception codec) { log.i(tag,"codec_configure " +codec.getmessage()); } //codec.start(); codec.getinputbuffers(); codec.getoutputbuffers(); inputbuffers = codec.getinputbuffers(); outputbuffers = codec.getoutputbuffers(); i getting nullpointerexception @ format.creatvideoformat() , illegalstateexception @ codec.start() could help me prepare it? i sense createvideoformat format = mediaformat::createvideoformat("video/avc", /*640*/320, /*480*/240); android h.264 android-4.2-jelly-bean decoder

linux - Using C++ bindings with GObject Introspection -

linux - Using C++ bindings with GObject Introspection - i decided want utilize goffice library in project. write in c++, prefer have c++ class interface, utilize gtkmm , not gtk+ directly. the documentation (see link above) says can utilize gobject introspection. started reading anout it. read , read , read, , couldn't understand how utilize binding of goffice. looked goffice gi-repository/typelib file on system, , in list of files installed packagekit. found nothing. checked in packagekit if goffice or goffice-devel packages depend on gobject introspection package. maybe depend indirectly, don't depend on straight (otherwise i'd see on list). i tried , tried, couldn't find resource explain how take library written in gobject, such goffice, , utilize on language, e.g. python, or in case c++. of course, can utilize c functions directly, point want have interface similar gtkmm. (i utilize gnu/linux, writing desktop application gtkmm , gnu build system, ...

sql - Combining multiple rows into one row where the data in only one column changes and adding the data for the varied column onto the end of the row -

sql - Combining multiple rows into one row where the data in only one column changes and adding the data for the varied column onto the end of the row - i hoping help me sql basic. below query: i have info looks this: policy number | commission amount | relationship | personlinked 50422 | 1000.00 | owner | john smith 50422 | 1000.00 | advisor | richard bass 50422 | 1000.00 | port man | craig thomson 74857 | 500.00 | owner | karen jones 98765 | 20000.00 | owner | tim crosby 98765 | 20000.00 | port man | josh bishop but want display of info in 1 row looks this: policy number | commission amount | owner | advisor | port man 50422 | 1000.00 | john smith | richard bass | craig thomson 74857 | 500.00 | karen jones | | 98765 | 20000.00 | tim ...

html - How do I get floating divs to break directly to the left of the viewport? -

html - How do I get floating divs to break directly to the left of the viewport? - please see illustration below, , shrink viewport width. as viewport width shrinks, want 4th div go straight under first div, , shrinks more, want 3rd div under 1st, , 4th under 2nd. understand why happening, don't know behaviour want. please help! <html> <head> <style> .columnclass { float:left; border: 2px solid; } </style> </head> <body> <div class="columnclass"> <img src="http://thecybershadow.net/misc/stackoverflow.png" width="400" height="400"/> </div> <div class="columnclass"> <img src="http://thecybershadow.net/misc/stackoverflow.png" width="200" height="600"/> </div> <div class="columnclass"> <img src="http://thecybershadow.net/misc/stackoverflow.png" width="400" h...

functional programming - Simple non-optimal unionfind in OCaml -

functional programming - Simple non-optimal unionfind in OCaml - i wrote ocaml programme union find algorithm. algorithm wrote not optimal , simplest version. i set ocaml code here because not sure whether code plenty or not (despite of algorithm itself), although code can run without errors. this first time wrote finish working thing after started larn ocaml, please help me reviewing it. useful suggestions help me improving ocaml skills. thanks type union_find = {id_ary : int array; sz_ary : int array};; allow create_union n = {id_ary = array.init n (fun -> i); sz_ary = array.init n (fun -> 1)};; allow union u p q = allow rec unionfy id_ary = allow vp = id_ary.(p) in allow vq = id_ary.(q) in if < array.length id_ary begin if != q && id_ary.(i) = vp id_ary.(i) <- vq; unionfy id_ary (i + 1) end else print_string "end of union\n" in unionfy u.id_ary 0;; allow is_conne...

amazon ec2 - is it possible to refer to an EC2 Elastic IP Address from within EC2? -

amazon ec2 - is it possible to refer to an EC2 Elastic IP Address from within EC2? - i have cluster of ec2 machines need able refer each other. using private ip address works leads problems whenever 1 of instances restarts. so, tried elastic ip addresses servers have fixed addresses. problem not not seem able refer machines elastic ips cloud. so, outside cloud ping elasticip , works. ssh of ec2 machines , when ping same elasticip fails. but, can ping machine's private address. bottom line: elastic ips outward facing? whether or not can ping instance depend on rules have setup security grouping instance belongs to. instances can utilize elastic ips talk each other, charged info transfer @ regional info transfer rate if instances in same availability zone (data transfer using internal ips free in case). amazon-ec2

facebook - Android sdk 3.0: How to set applicationId when using UiLifecycleHelper.java? -

facebook - Android sdk 3.0: How to set applicationId when using UiLifecycleHelper.java? - i migrated fb android 2.0 3.0. instead of using <meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/app_id"/> in androidmanifest.xml, wanted programmatically set application id session. i know can utilize session.builder.setapplicationid() upon creation of session object. however, when utilize uilifecyclehelper.java, creates session without using session.builder. uses constructor (session = new session(activity)). seems assumes defined meta-data app id in manifest file. however, want uilifecyclehelper.java create session using session.builder , programmatically applying application id in oncreate(). how can it? google haven't found solution yet. mutual practice utilize meta info set fb application id in manifest file? don't want reveal app id putting in xml file. please help! your application id not considere...

php - Paypal Script Working, But No Money Transferred -

php - Paypal Script Working, But No Money Transferred - i have integrated paypal payment gateway in script, i have tested in paypal sandbox , worked perfectly. made script "paypal live", certainly changed variable named $environment. it worked without error, problem that, no money got transferred paypal account.. i have checked paypal api's signatures, etc, , tottaly okay that.. but still no money got transferred.. i though may post here help function paiement_succes() { // obtain token paypal. if(!array_key_exists('token', $_request)) exit('token not received.'); // set request-specific fields. $token = urlencode(htmlspecialchars($_request['token'])); // add together request-specific fields request string. $nvpstr = "&token=$token"; // execute api operation; see pphttppost function above. $httpparsedresponsear = $this->pphttppost('getexpresscheckoutdetails', $nvpstr); if(...

javascript - Calling jQuery function by var reference -

javascript - Calling jQuery function by var reference - i'm trying alter jquery function called using value of switch. in particular case grab selector utilize whatever value of 'direction phone call on jquery function. $('#'+the_name).value_of_switch(options.speed_up); how can accomplish this? switch(direction){ case 'up': direction = 'slidedown'; break; case 'down': direction = 'slideup'; break; } $('#'+the_name).slidedown(options.speed_up); not sure mean, help? $('#'+the_name)["your string value here"](options.speed_up); javascript jquery jquery-plugins

javascript - How to determine the top element? -

javascript - How to determine the top element? - i have complex construction of many nested, absolutely positioned elements. these elements may or may not have z-index set. they may or may not have same parent element. i wondering best / simplest way homecoming element on 'top'. following... $(".panel").topmost() thanks (in advance) help a plugin there .. topzindex $.topzindex("div"); javascript jquery

jquery - HTML5 Application Cache - Javascript not working -

jquery - HTML5 Application Cache - Javascript not working - i'm writing web app used offline on ios. http://www.addictedtocolors.com/pba/pba_eng.html it's caching (html, images, css, js) it's not executing jquery. i can't undertand what's wrong , can't figure out solution. here's html <!doctype html> <html manifest="offline.appcache"> <head> <meta charset="utf-8" /> <title>pba</title> <link type="image/x-icon" rel="shortcut icon" href="img/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta content="yes" name="apple-mobile-web-app-capable" /> <!-- ipad (retina) icon--> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="icon/pba-icon-144x144.png" /> <!-- iphone (retina) icon--> <link rel=...

windows - Can I install a driver only through modifying registry? -

windows - Can I install a driver only through modifying registry? - to knowledge, there @ to the lowest degree 4 approches install kernel driver: through setupxxx; through service manager; through inf file; through registry; provided have minifilter driver, wonder if next installation steps work? step 1. re-create mydriver.sys %systemroot%\system32\drivers\ step 2. add together subkey named mydriver under hkey_local_machine\system\currentcontrolset\services step 3. add together values start , type , tag , group , altitude , imagepath , etc. under subkey mydriver ; step 4. set value start 0, i.e. tell os load mydriver.sys @ boot time; step 5. reboot. my questions is: there disadvantages of method? windows installation registry kernel driver

ASP.NET, MVC, C# website pass a value though out the application -

ASP.NET, MVC, C# website pass a value though out the application - this bit of puzzle me. i need capture uri query string passed home page. as user travels different pages on web site, have partial view needs uri query string. i need dynamicly created link in partial view, equals original phone call home page. example - if user goes - http://www.mysite.com?mode=joe , need dynamicly created link equal - http://www.mysite.com?mode=joe if user goes - http://www.mysite.com?mode=tommy , need dynamicly created link equal - http://www.mysite.com?mode=tommy fyi - partial view used in _layout.cshtml file. phone call within - _layout.cshtml looks - @html.partial("mypartial") thanks! there number of ways this, simplest save session on home page, , access session variable partial. you need decide if session expires. another possible way write cookie on home page request , access request cookie in partial. again, you'd need decide on appr...

html - Left align drop down menu under parent -

html - Left align drop down menu under parent - i've spent days trying left-align drop downwards menus under parents. css & html know i've learned through process in past few days, treat me kid in responses, lol. you'll see i've survived far making notes on means... here's blog can see it's doing crittndesign.blogspot.com started out "featured products" tab & drop downwards when created menu. in order align drop downwards under parent, set actual value on how far left wanted (68px seemed work). did wanted time being, decided add together "inspiration for..." tab , see need prepare problem , have proper coding menus left align under own parent tabs. my code mess since i've tried many different things now, need tell me alter create right! read lot needing position either "relative" or "inline-block" apparently don't know stick because breaks drop downwards remove fixed position (left:...

php - Appending html select box to page that is populated with MYSQL query results -

php - Appending html select box to page that is populated with MYSQL query results - normally when creating dynamically populated drop-downs i'd utilize simple foreach loop below data: <select name="region" id="region" tabindex="1"> <option value="">select course</option> <?php foreach ( $courses $course ) : ?> <option value="<?php echo $course->coursename; ?>"><?php echo $course->coursename; ?></option> <?php endforeach; ?> </select> *where $courses = select("select * courses"); etc etc what i'm not sure possible utilize in current form within javascript function such 1 below i've been using on forms append additional input fields per requirements of user. works fine text input, illustration (and below can utilize if type out each input alternative manually) i'm not @ sure best way recreate php/mysql illustratio...

Hibernate criteria by a list of natural ids -

Hibernate criteria by a list of natural ids - i trying create hibernate criteria using list of natural ids. saw illustration here http://docs.jboss.org/hibernate/core/3.5/reference/en-us/html/querycriteria.html#query-criteria-naturalid shows illustration querying single record: session.createcriteria(user.class) .add(restrictions.naturalid() .set("name", "gavin") .set("org", "hb")); is there improve way create criteria list of natural ids illustration below? junction junction = restrictions.disjunction() .add(restrictions.naturalid() .set("name", "gavin") .set("org", "hb")) .add(restrictions.naturalid() .set("name", "jdoe") .set("org", "rh")); session.createcriteria(user.class) .add(junction); thanks. in experience, no. reason due limitations of sql in implementations. when seek phrase in sql gets...

php - i want to split data from database into three columns of table -

php - i want to split data from database into three columns of table - i want split info database 3 columns of table don't how have tried it's not working please help me in advance <?php $count=1; $query1=mysql_query(" select *,category.id ids category inner bring together products on category.`cid`=products.`cid` category.id='$id' ") or die ('product query problem'); while($row1=mysql_fetch_array($query1)) { $count++; ?> i want split info database 3 columns of table don't how have tried it's not working please help me in advance <div class="main_content"> <div class="featured-items clearfix"> <div class="items clearfix"> <table border="0"> <tr> <td><div class="item-block-1"> <div class="image-wrapper"> <div class="image"> <div class="overlay"> <div class="p...

Java, separator between JMenuBar and other components -

Java, separator between JMenuBar and other components - in java swing how can alter color of separator between jmenubar , other components. alternatively remove separator. afaiu: jmenubar.setborder(borderfactory.createlineborder(color.black)); java separator jmenubar

java - Conway's Game of life overpopulation? -

java - Conway's Game of life overpopulation? - i working on conway's game of life clone because practice, ran problem. see there pixels deleting , rebirthing, pixels spread out end of screen , other pixels rebirthing, idling @ point. here screenshots: i'll show of code logic of this. handled in change method: class="lang-java prettyprint-override"> package main; import java.awt.color; import java.awt.graphics; public class functions { public static int pixelsize=6,gridwidth=800/6,gridheight=600/6; static int[][] pixels = new int[gridwidth][gridheight]; static boolean first = true; public static void change(){ for(int = 0; < gridwidth; i++){ for(int j = 0; j < gridheight; j++){ int neighbors = 0; //check each cell try{ if(pixels[i+1][j] == 1){neighbors++;} if(pixels[i-1][j] == 1){neighbors++;} if(pixels[i+1][j-1] == 1){neighbors++;} if(pixels[i][j+1] == ...

Decode AMR audio file in Android -

Decode AMR audio file in Android - is there way decode amr sound file in android , have access raw sound data? mediacodec available api 16 , above. need work on android 2.2 , above. i think there's no native api in 2.x platforms doing this. can utilize ffmpeg binaries in application instead. with quick search found this precompiled version of ffmpeg android 2.2. you can place executable in application raw resources folder , utilize runtime.getruntime().exec() execute it. to convert amr file wav ffmpeg can this: ffmpeg -i file.amr file.wav and convert wav raw pcm can following: (taken here) ffmpeg -i file.wav -f s16le -acodec pcm_s16le file.pcm android decode amr

Passing a long string between Java and PHP? -

Passing a long string between Java and PHP? - i have method takes long string, 90,860 characters , passes php page inserted database. i've read there isn't limit on size of php post upto 8mb. i'm assuming length of string should ok. msg = urlencoder.encode(stringtoencode.tostring(),"utf-8"); defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://mysite.com/insert.php?data="+msg); httpresponse response1 = httpclient.execute(httppost); i know works can insert short plain strings. on php page post info like: $data = $_get['data']; and insert it. need add together php de-code post message? read should done automatically php. the problem long string either 500 error or if take string , set in browser page not available. thanks in advance! in java programme should not pass data, when long, in url, see this question illustration code how pass ...

ios - Losing my Emoji, probably in UTF8String -

ios - Losing my Emoji, probably in UTF8String - i'm doing type of thing: const char *cstring = [textin utf8string]; and later this: cgcontextshowtext(ctx, cstring, strlen(cstring)); i'm losing emoji in process, though font selected cgcontextselectfont supports them. there easy workaround? ios objective-c core-graphics

objective c - Web View Not Saving HTML5 Local Storage Settings -

objective c - Web View Not Saving HTML5 Local Storage Settings - i have web app works fine in safari (it uses local storage , saves settings , restores them). i created web view in xcode 4.5.2 loads web app. know default web view doesn't back upwards local storage added code enable app doesn't work @ all. my code in appdelegate.m: - (void)applicationdidfinishlaunching:(nsnotification *)anotification { webpreferences *prefs = [webview preferences];. [prefs _setlocalstoragedatabasepath:@"~/library/testapp/localstorage"]; nsstring *path = [[nsbundle mainbundle] pathforresource:@"test" oftype:@"html"]; nsurl* fileurl = [nsurl fileurlwithpath:path]; nsurlrequest* request = [nsurlrequest requestwithurl:fileurl]; [self.webview.mainframe loadrequest:request]; } @end this part added enable local storage: webpreferences *prefs = [webview preferences];. [prefs _setlocalstoragedatabasepath:@"~/librar...

Deploying Rails Apps to heroku from multiple PC -

Deploying Rails Apps to heroku from multiple PC - i rails newbie , learning build rails apps. first time deploy home pc , fine, want work on apps , deploy laptop , work pc, turn out cannot deploy update code. every time force github work fine, when want force heroku didn't deploy code. opened heroku apps, , it's out-dated $ git force counting objects: 26, done. delta compression using 2 threads. compressing objects: 100% (13/13), done. writing objects: 100% (14/14), 1.22 kib, done. total 14 (delta 9), reused 0 (delta 0) git@github.com:myprofile/myapp.git bb15762..94d0674 master -> master $ git force heroku master up-to-date i utilize linux on virtualbox , clone each pc, has identical id , mac believe. did necessary git remote add together heroku , in end heroku ignore update code , never rerun build. i tried run command $ heroku rollback $ heroku restart --app myapp in order update code force heroku still did't work either. when run $ heroku...

.net - In C# While Using Interop HTML 2 XHTML Lib Dll Source Code Giving Error -

.net - In C# While Using Interop HTML 2 XHTML Lib Dll Source Code Giving Error - when seek convert html xhtml tag i'm getting next error... error: retrieving com class mill component clsid {59939390-0e6a-4f1b-a742-20c5459501f7} failed due next error: 80040154. after googling found few solutions: registering dll regsvr32 "e:source code\bin\interop.html2xhtmllib.dll" i'm tried register dll. e:source code\bin\interop.html2xhtmllib.dll loaded. dllregisterserver entry point not found error message displayed. why..? recompiled project x86 , x64.. no use.. vb.net code: dim xhtmlutil new xhtmlutilities // here im getting above error. sformattedoutput = xhtmlutil.converttoxhtml(sinputline) //send conversion my operating scheme windows xp 32-bit service pack 3. application done in vs2008. i'm working vs2010. here i'm missing. 1 help me figure out problem? thanks in advance. i'm tried register dll. e:source co...

c++ - auto_ptr or shared_ptr -

c++ - auto_ptr or shared_ptr - in c++03 environment, utilize auto_ptr or (boost) shared_ptr homecoming resource function? (where in c++11 1 naturally utilize unique_ptr .) auto_ptr<t> f() { ... homecoming new t(); } or shared_ptr<t> f() { ... homecoming new t(); } auto_ptr has quite pitfalls (not to the lowest degree it's construction awfully buggy on msvc 2005 have use), shared_ptr seems overkill ... in c++03, utilize either bare pointer or auto_ptr , allow caller decide on ownership strategy. note 1 of pitfalls of smart pointers covariance not apply them, meaning can override base* f() derived* f() cannot override std::x_ptr<base> f() std::x_ptr<derived> f() ; , in case have no selection utilize simple pointer. c++ shared-ptr auto-ptr visual-c++-2005

c# - Getting HTML Generated By ASP.NET MVC View -

c# - Getting HTML Generated By ASP.NET MVC View - i'm working on asp.net mvc 4 app. i'm trying build study screen takes while (~30 seconds) generate due data. html that's generated view , save text file. is there way html generated view? if so, how? please note .cshtml file includes razor. i'm not sure if plays equation or not. thank much help! i utilize next function sort of thing, when want create email html using razor: public static string renderviewtostring(string viewname, object model, controllercontext context) { context.controller.viewdata.model = model; using (var sw = new stringwriter()) { var viewresult = viewengines.engines.findpartialview(context, viewname); var viewcontext = new viewcontext(context, viewresult.view, context.controller.viewdata, context.controller.tempdata, sw); viewresult.view.render(viewcontext, sw); homecoming sw.getstringbuilder().tostring(); } } c# asp.net-m...

cloudfoundry - set up Cloud Foundry in multiple cloud controler mode -

cloudfoundry - set up Cloud Foundry in multiple cloud controler mode - i utilize dev_setup install cloud foundry 4 nodes. 1 rest node , other dea node ,the 3rd mysql0 node ,and lastly mysql1 node,but there 1 cloud controler node ,that rest node. how can set cloud foundry in multiple cloud controler mode ,for example,two cloud controler nodes? this question candidate cloud foundry developers cloudfoundry

Rails ActiveRecord define database objects within other object -

Rails ActiveRecord define database objects within other object - i'm relatively new rails , new database manipulation. i'm trying create class within database contains number of custom objects within it. these custom objects stored in database in separate table. i've managed set follows class myclass < activerecord::base has_many :other_objects, :dependent => destroy end class otherobject < activerecord::base belongs_to :my_class attr_accessible :some_stuff... end i've created appropriate database tables , managed working. now want have (four) particular instances of "otherobject"s in class, can accessed straightforward identifier, test = myclass.new ... test.instance_of_other_object.some_attribute = "blahblah" such updates database entry associated object. best way go this? that has_many association sets myclass#other_objects (and a bunch of other methods) allow work associated records. you want: my...