Posts

Showing posts from July, 2014

javascript - JSON string created in Rails replaces whitespace with plus sign (+) -

javascript - JSON string created in Rails replaces whitespace with plus sign (+) - rails: object = object.find_by(params[:id]) object_items = { "1" => { :id => "123456", :name => "pancakes yum!" }, "2" => { :id => "789010", :name => "hello 123" }} cookies[:something] = { "id" => object.id, "title" => object.title, "object_items" => object_items }.to_json let's object.title produces string "hello world" cookie content: %7b%22id%22%3a2%2c%22title%22%3a%22hello+world%22%2c%22object_items%22%3a%7b%221%22%3a%7b%22id%22%3a%22123456%22%2c%22name%22%3a%22pancakes+yum!%22%7d%2c%222%22%3a%7b%22id%22%3a%22789010%22%2c%22name%22%3a%22hello+123%22%7d%7d%7d problem: the json string beingness created replaces/escapes whitespace plus sign ( + ) instead of %20 means if read string , grab value object.title in html/javascript read "hello+world...

groovy - Grails Join Table column name -

groovy - Grails Join Table column name - my alert has many location objects, , have bring together table alert_locations . the generated columns are: alerts_locations_id (i want alert_id ) location_id here's domain object: class alerts { static hasmany = [locations:locations,notifications:notifications] date alertdatetime string pest string crop static constraints = { alertdatetime (blank:false) pest (blank:false) crop (blank:false) } } static mapping = { locations jointable:[column:"location_id", key:"alert_id"] grails groovy gorm jointable

java - Creating 3x3 checkerboard over a picture using Graphics2D -

java - Creating 3x3 checkerboard over a picture using Graphics2D - i want create overlay of 3x3 checkerboard, non-solid squares should transparent. i don't want iterate pixels, rather draw squares using graphics2d create checkerboard. (do need loop, if statement, or both?) here's code far: picture mypict = new picture(mypathname); mypict.show(); graphics2d graphicsobj = mypict.getgraphics2d(); final int width = mypict.getwidth() / 3; final int height = mypict.getheight() / 3; (int = 0; > width; = width * 2) { rectangle2d.double shape1 = new rectangle2d.double(width, height, 0, 0); graphicsobj.draw(shape1); } i'd utilize combined (double) loop/if statement drawing solid parts of checkerboard. in pseudo-code might expressed as: draw image each row { each column { if 'odd' square number { graphics fill rectangle } } } java awt graphics2d

c# - query a list of dynamic objects for a FirstOrDefault -

c# - query a list of dynamic objects for a FirstOrDefault - the next code homecoming enumerable of dynamic objects. protected override dynamic get(int id) { func<dynamic, bool> check = x => x.id == id; homecoming enumerable.where<dynamic>(this.get(), check); } how select firstordefault single object not enumerable? similar this answer want singleordefault. simplest way probably protected override dynamic get(int id) { homecoming get().firstordefault(x=>x.id==id); } since people have had problem making work, test new .net 4.0 console project (if convert 3.5 need add together system.core , microsoft.csharp references) , paste program.cs. compiles , runs without problem on 3 machines i've tested on. using system; using system.collections.generic; using system.linq; using system.dynamic; namespace consoleapplication1 { internal class programme { protected dynamic get2(int id) { fun...

Why is fortran used for scientific computing? -

Why is fortran used for scientific computing? - i've read fortran still heavily used scientific computing. code heavily invested in fortran makes sense me. but there reason utilize fortran on other modern languages new project? there language design decisions in fortran makes much more suitable scientific computing compared more popular languages (c++, java, python, ruby, etc.)? example, there specific language features of fortran maybe allow numeric optimization in compilers much higher grade compared other languages mentioned? fortran is, improve or worse, major language out there designed scientific numerical computing. it's array handling nice, succinct array operations on both whole arrays , on slices, comparable matlab or numpy super fast. language designed create hard accidentally write slow code -- pointers restricted in such way it's obvious if there might aliasing, standard illustration -- , optimizer can go town on code. current incarnat...

terminal - How to set vim key mapping to normal? -

terminal - How to set vim key mapping to normal? - i know "normal" subjective term, know mean. i'm on mac. want "delete" backspace, hitting left @ origin of line jumps end of previous line, , other keys i'm used to. i'm typing right now. there simple way , still able utilize terminal non-gui version without having remap each key individually? please no "get used it" answers. need 1 class. don't want used it. :) terminal type (or whatever phone call it) xterm-256color/tcsh. you should take @ vim's easy mode - start vim -y flag(or run evim ) create behave regular text editor. when in easy mode, in insert mode. if ever need regular vim commands, utilize ctrl-l come in vim's normal mode, or ctrl-o come in single normal mode command , homecoming insert mode. more info in :help easy , :help evim-keys . vim terminal

django middleware - Python changing modifying via imported function -

django middleware - Python changing modifying via imported function - i trying create function, when imported , called, check , modify tuple. able phone call multiple times. however, have function homecoming new variable, because can not figure out way alter variable in place. here examples 2 files, how work: **modifier.py** import variable def function(new_string): if new_string not in variable.tuple: variable.tuple = new_string, + variable.tuple **variable.py** import modifier tuple = ('one','two',) modifier.function('add this') modifier.function('now this') #--> tuple should equal ('now this', 'add this', 'one', 'two',) however right have this: **modifier.py** def function(tuple_old, new_string): if new_string not in tuple_old: homecoming new_string, + tuple_old **variable.py** import modifier tuple = ('one','two',) tuple = modifier.function(tup...

c# - memorizing values in variables VS using functions/methods that return values -

c# - memorizing values in variables VS using functions/methods that return values - i have been wandering time now. i'm still beginner, programs simple , require no resources. i'm familiar c++, java , c#. in future things more complicated, more variables , objects , more functions/methods. in order alter value of variable, can phone call function/method, changes value, once. after when need variable, have phone call it. takes less time value. if function lot of work, time has consumed experienced once. variables require space in memory , when quantity gets quite big, can become problem. but can phone call function/method returns value need. need utilize variables necessary, means- less variables. it's not problem if function/method short. functions/methods must quite lot of work before homecoming value. way programme seem slower user. my question is: memorizing values in variables vs using functions/methods homecoming value: better, when , why? this que...

nsarray - UITableView addcell to bottom in edit mode -

nsarray - UITableView addcell to bottom in edit mode - i'm trying create table add together cell @ bottom of table adding cells, table on delete mode, people can delete, so need add together cell insert insert cell. errors saying app isn't consistent nsarray. how create work? step 1 override setediting on tableviewcontroller insert or delete add together row - (void)setediting:(bool)editing animated:(bool)animate { bool prevediting = self.editing; [super setediting:editing animated:animate]; [tableview setediting:editing animated:animate]; if (editing && !prevediting) { // started editing [self.tableview insertrowsatindexpaths:....] withrowanimation:uitableviewrowanimationfade]; } else if (!editing && prevediting) { // stopped editing [self.tableview deleterowsatindexpaths:....] withrowanimation:uitableviewrowanimationfade]; } } then ensure returning right number of rows - (ns...

internet explorer - CSS in ie only works with dev tools -

internet explorer - CSS in ie only works with dev tools - been enjoying first-class answers on here while , it's time myself reply question. i'm working on web site pretty tight design. works great in ff when comes ie have problems content not showing. the content gives me problems placed in width , height specific divs. of content renderes not all. i tried utilize ie dev tools , found if disable and/or enable css rule content rendered in ie. can't figure out if problem in css or issue ie/bootcamp install. should run ie on bootcamp partition on mac. don't know if has impact on issue. ie version 8 anyone experienced similar issues? ok, seems bug in ie/dev tools somehow had relative positioning. my css didn't work though seemed when enabled/disable css rule through dev tools. the prepare pure css , had nil ie, dev tools or bootcamp installation. however, seem stumbled upon bug in ie/dev tools, is, fact enabling or disabling random cs...

c - How to connect socket via external IP (Mac ) -

c - How to connect socket via external IP (Mac ) - my question is, how connect socket on romote mechine? can connect sockets on same network.. i wrote simple code (in c), simulate server (open socket , hear client). in mac. i'm trying connect socket client iphone (with simple objectiv-c code). if net on both, server , client, on same network (wifi) , in client trying connect 192.168.1.x, it's working. when, in client, i'm trying connect via external ip (with same port) connection failed. i never did bofore. maybe miss somthing.. i've tried turn firewall off. did not help. thanks. edit: if it's not clear.. mac connected router. in setting this, "external ip" typically ip of router. in likelihood you'll need configure router forwards relevant port internal ip address. it case port forwarding work, request has come in on external (wan) interface. depends on how router configured. if that's case, you'll need create s...

sql server 2008 - How can I nest stored procedures that return XML using FOR XML PATH? -

sql server 2008 - How can I nest stored procedures that return XML using FOR XML PATH? - i have xml path stored procedure returns xml in usual manner (shortened clarity): create procedure sp_returnsubnode begin select subnode.subnodeid "@subnodeid" ,subnode.somedata "somedata" subnode xml path('subnode') end i have stored procedure include results of above query within e.g. create procedure sp_returnmainxml begin select node.nodeid "@nodeid" ,node.nodedata "data" ,[at point phone call sp_returnsubnode , nest it] ,node.moredata "moredata" node xml path ('node') end but methods have tried assigning results of executing sp_subnode xml datatype , attempting nest have failed. this seems people want haven't found reference on how it. possible? you can user defined functions returns xml. a function returning xml: create function getsubnode(@p int) returns xml beg...

javascript - How can I make a jquery $.when statement refire if it fails? -

javascript - How can I make a jquery $.when statement refire if it fails? - so due kind of server asynchronicity issue, or something.. don't know what, happens every 1 time in while (s_mcir_2 calls own ajax functions cross-domain, other server suppose can unreliable).. anyway, every 1 time in while result returned s_mcir_2 null instead of json object. when happens, test if null, , if is, have $.when statement refire.. theoretically until receives valid output. any ideas? $.when(s_mcir_2(alt, data[l_alt])).then(function(result) { //evaluate "result" }); deferred objects can resolve once. try using named function calls on fail. function myfn () { $.when(s_mcir_2(alt, data[l_alt])).then(function(result) { //evaluate "result" if (!result) { settimeout(myfn,125); log("r_mcir_2 has failed"); } else { // success, stuff ... } }); } javascript jquery ajax

php - How to ask LightOpenId to get the users email in checkid_immediate mode? -

php - How to ask LightOpenId to get the users email in checkid_immediate mode? - premises: i using php lightopenid authenticate users through google account. i using standard sample provided (example.php) website. nil fancy. adding 1 line or 2 alter behavior. all clients googlers. requirement1 i not want client log twice (sso behavior), add together $openid->mode=checkid_immediate before calling header...$openid->authurl() . i experience 2 problems: i cannot email, lang ... attributes. in fact, using checkid_immediate mode , next authurl() user connected correctly expected. but modifying code , adding $openid->required gather attributes prior authurl() request forces phone call converted checkid_setup mode call. how can i, in 1 call, maintain checkid_immediate mode , attributes ? subdomain.mydomain2.com code not behave www.mydomain1.com www.mydomain1.com works fine checkid_immediate . subdomain.mydomain2.com same code converted chec...

javascript - Firefox's App object eqivalent in other browsers -

javascript - Firefox's App object eqivalent in other browsers - i'm not js guy, barely touched when needed need create changes mvc3 app, uses javascript, , when seek run in ie, gets errors on first line of scripts, in code below : app.listloan = new function; it works in ff. what should equivalent, or "browser safe" code this? edit: actually, after investigating code more, discovered app object defined. in _layout.cshtml, have defined: <script src="@url.content("~/scripts/app/app.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/app/listenvelope.js")" type="text/javascript"></script> the code in app.js /* main component */ var app = { init: function () { /* ....*/ } and in listenvelope.js have cpde shown works in ff not in ie can tell me problem? thanks if(typeof app === 'undefined') { // no app names...

php - Multitable stores when other store locations are in sub-table -

php - Multitable stores when other store locations are in sub-table - so have database allows list of businesses. master table has client aka businesses details: id firstname lastname tradingname storeaddress state postcode in table called otherstores, have following: master_id store_id storeaddress state postcode phonenumber what need php script allows me show stores in list function here catch: i want show 8 stores different types of categories random. however need not show store twice on same search. need create sub-stores aka otherstores randomly added query seeable well. i wondering best way this. why don't have code: it's tough show code thought left bring together or inner bring together , limit id 1. however know won't work because need able bring together them how, want each sub store master store if bring together master table can't see working, , instead errors. php mysql table select

Oauth in spring web mvc project -

Oauth in spring web mvc project - i need add together oauth security spring mvc project. the project have basic security implement org.springframework.web.filter.delegatingfilterproxy customauthenticationprovider , need replace oauth2 . is there simple way ? thanks. we have done same in 1 of our applications using spring 4 , java 8. application open source , can read security layer here http://blog.techdev.de/using-spring-oauth-in-trackr/ spring-mvc oauth

android - How do I post data into the Facebook wall without login-dialogbox? -

android - How do I post data into the Facebook wall without login-dialogbox? - i working on android app come in text in edit box. want send text typed (i.e. edittext.gettext() ) facebook status. of import thing don't want facebook dialog box pop up, instead, send message status without dialog box. there way post without dialog box? i not sure utilize total you, masyncrunner.request(null, params, "post", new photouploadlistener(), null); masyncrunner.request("me/photos", params, "post", new photouploadlistener(), null); and still if problem exists because of existing facebook app in device, might have create login compulsory. in piece of code, do public void loginandposttowall(){ facebook.authorize(this, permissions,-1, new logindialoglistener()); } it should trick. android facebook

Getting width of Monotouch.Dialog UIViewElement? -

Getting width of Monotouch.Dialog UIViewElement? - i'm trying create uiview (for uiviewelement), how bounds (at to the lowest degree width) of uiviewelement? thanks mojo uiviewelement takes view pass constructor , adds contentview of uitableviewcell. since cells dynamic , not of them same size... i recommend create uiviewelement subclass contentviewbounds property , set value within getcell method custom element. monotouch monotouch.dialog

C++ memory: deleting an unused array of bool can change the result from right to wrong -

C++ memory: deleting an unused array of bool can change the result from right to wrong - i trying solve project euler problem 88, , did without much effort; however, find seemingly irrelevant code in programme affecting result. here's finish code (it's not short, cannot locate error. believe obvious more experienced eyes, please read description first): #include <iostream> #include <set> using namespace std; bool m[24001][12001]; bool p[24001]; // <------------ deleting line cause error in result! long long answer[12001]; int main() { long long i; long long j; long long l; set<long long> all; long long s = 0; (i = 0; <= 24000; i++) { (j = 0; j <= 12000; j++) { m[i][j] = false; } } m[1][1] = true; (i = 2; <= 24000; i++) { m[i][1] = true; (j = 2; (j <= i) && (i * j <=24000); j++) { (l = 1; l <= i; l++) { if (m[i][l]) { m[i * j][l + 1 + (i * j) - - j] = true; ...

javascript - how to fetch parameters from request string for ajax post request -

javascript - how to fetch parameters from request string for ajax post request - i sending request ajax post request, asp classic how can fetch parameters send request my code snippet below var url = "get_data.asp"; var params = "lorem=ipsum&name=binny"; http.open("post", url, true); http.setrequestheader("content-type", "application/x-www-form-urlencoded"); http.setrequestheader("content-length", params.length); http.setrequestheader("connection", "close"); http.onreadystatechange = fetch_data; http.send(params); please help me from perspective of asp post request other, so; x = request.form("lorem") y = request.form("name") http://www.codeguru.com/csharp/.net/net_asp/article.php/c19325/ javascript post asp-classic vbscript

php - Fixed Proportionate Selection -

php - Fixed Proportionate Selection - i have set of elements , need take 1 element out of it. each element associated percentage chance. percentages add together 100. i need take 1 out of element chances of element beingness chosen equal percent value. if element has 25% chance, supposed have 25% chances of getting chosen. in other words, if take elements 1 mil times, element should chosen near 250k times. what describe multinomial process. http://en.wikipedia.org/wiki/multinomial_distribution#sampling_from_a_multinomial_distribution they way generate such random process this: ( i'll utilize pseudo code should easy create in real code. ) sort 'boxes' in reverse order of probability: (not needed. it's optimization) have illustration values=[0.45,0.3,0.15,0.1] then create 'cumulative' distribution, sum of elements index <=i. pseudocode: cumulant=[0,0,0,0] // initiate s=0 j=0 size()-1 { s=s+values[i] ; cumulant[i]=s } ...

In ASP.NET MVC3 how do you stay DRY with very similar but slightly different viewmodels? -

In ASP.NET MVC3 how do you stay DRY with very similar but slightly different viewmodels? - in building app, created generic object model store values, viewmodel looks bit @ moment: public class fooviewmodel { public int id { get; set; } public byte footype { get; set; } [required] [display(name = "bar name")] public string name { get; set; } [required] public string email { get; set; } //etc, etc } the problem is: depending on footype, want have display name different , email not required type 1 , 2, required type 3 , 4. we tried seperating out properties differ per type in classes inherit one, validation a fallback on specified in base of operations type, didn't work. currently, alternative seems to create viewmodel each footype (and seperate controllers , view), leads lot of code duplication. what other ways maintain dry? to benefit validation context (e.g. validating objects in different contexts), recommen...

JavaScript: Detecting browser library function - does one exist? -

JavaScript: Detecting browser library function - does one exist? - i looking write single, modern , up-to-date javascript function (or find one) - circa 2012 - reliably observe browsers. along lines of (pseudo-code): function detectbrowser(){ if ie{ /* code observe ie version / quirks mode */ homecoming object containing ie version , boolean quirks mode? } else if webkit{ /* same thing. homecoming browser */ } else if gecko{ /* same thing. */ } } anyone know of this? since know there people asking "why want this?", want such function can built atop of in different scenarios, such loading different style sheets based on browser. if have alternative of using jquery, there jquery.browser , has been deprecated , recommend using jquery.support , has whole raft of properties tell browser or doesn't support. see: http://api.jquery.com/jquery.support/ for stylesheet rendering example, don't need ...

directory structure - Force Xcode to create a Finder folder when creating a new project group -

directory structure - Force Xcode to create a Finder folder when creating a new project group - for while have been creating folders in finder, adding them groups xcode projects. there way forcefulness xcode reverse , save me step -- i.e., create new folder when add together grouping project? you can't, thing can click on "add folder..." button on "add files" window. xcode directory-structure

How can I obtain the date object from a timestamp in PHP? -

How can I obtain the date object from a timestamp in PHP? - how can obtain date object timestamp in php ? e.g. $timestamp = 1349938801; the first thing comes mind createfromformat: $datetime = datetime::createfromformat('u', '1349938801'); php date time

CSS/PHP: How to make left and right float div the same height regardless of much information is in them? -

CSS/PHP: How to make left and right float div the same height regardless of much information is in them? - how create left , right float div same height regardless of much info in them? number of divs created dynamically alternating left , right info in them. <div class="columns"> <?php $cemp = true; foreach ( $req_user_emp $id => $name ) { echo "<div ".(($cemp = !$cemp)?" class=\"column_right\"":" class=\"column_left\"").">"; echo "<h3>".$req_user_emp[$id]['position']."</h3>"; echo "<h4>".$req_user_emp[$id]['company_name']."</h4>"; echo $req_user_emp[$id]['description']; echo "<div class=\"column_footer\">".$req_user_emp[$id]['start_date']." → ".$req_user_emp[$id]['end_date']."</div></div>"; }...

How to recreate Android 4.0 Lockscreen -

How to recreate Android 4.0 Lockscreen - i wondering if possible recreate android 4.0 lockscreen within application. want utilize way navigate through app. possible pull source of lockscreen rom , modify fit? know how recreated? doesn't seem anyone's tried before according google or similar questions on side, input much appreciated! as stated in answer, source code android lock screen can found in platform/frameworks/policies/base git repository, in phone/com/android/internal/policy/impl/lockscreen.java file. can read instructions on how download android source code here, or can read source file online here. edit: sorry, posted source code older version of lock screen 1 looking (from sometime around 2010, believe). nevertheless, android lock screen water ice cream sandwhich should in android source code somewhere, should able search bit , find it. android lockscreen android-4.0

getDay() in Javascript Error -

getDay() in Javascript Error - can shed lite on getday() in javascript please. here datepicker textbox gets value jquery datepicker control var callbackdatenumber; // check value in date of callback command if(("#datepicker")!="") { callbackdatenumber = new date($("#datepicker").val()).getday(); } else { callbackdatenumber=new date().getday(); } for jan date gives 0,1...6- sunday saturday. but same order not preserved in month febraury. any reason why happening? your dates need in mm/dd/yyyy format. it's parsing 05/02/2012 may 2, 2012 , 06/02/2012 june 2, 2012. javascript

windows - fastest IN PROCESS technique for sharing memory and IPC in win32/C/C++ -

windows - fastest IN PROCESS technique for sharing memory and IPC in win32/C/C++ - i'm writing real time library exports standardized interface (vst) , hosted external applications. the library must publish table viewable thread in same process (if knows look) - clear, table must viewable dlls in process space - if know look. accessing table must fast. virtual memory seems overkill, , i've considered using window handle (and still may) message pump, i'd prefer faster method, if 1 available. also, shared info segment in pe i'd avoid if possible. think i'd rather utilize window handle. i'm not concerned synchronization @ moment, can handle after fact. i'd suggestions fastest technique publish table within process space. you seem confused. threads in same process share same address space, don't need form of ipc: if thread knows address of table, can access it. c windows dll shared-memory

zend framework - Hide only the default controller name from the URL -

zend framework - Hide only the default controller name from the URL - is possible forcefulness zend_router check defaultcontroller it's actions, , skip controller name in url, if action in default controller ? ie. /defaultcontrollername/action/ -> /action/ /nondefaultcontorller/action/ -> /nondefaultcontorller/action/ if it's impossible what's convention handle situation ? static routes can accomplish you'd have add together 1 each of actions in index controller. so mysite.com/add go index controller add together action. protected function _initroutes() { $frontcontroller = zend_controller_front::getinstance(); $router = $frontcontroller->getrouter(); $route = new zend_controller_router_route_static('add', array('controller'=>'index','action'=>'add')); $router->addroute('add',$route); } zend-framework zend-route

ruby on rails - link_to_unless_current method not working -

ruby on rails - link_to_unless_current method not working - i using breadcrumbs_on_rails gem.i want lastly link non clickable.the code in breadcrumbs.rb . def render   @elements.collect |element|     render_element(element)   end.join(@options[:separator] || " » ") end def render_element(element)   content = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options)   if @options[:tag]     @context.content_tag(@options[:tag], content)   else     content   end end here inspite of link_to_unless_current function lastly link still clickable . the 2 urls http://abc.com/1 , abc.com/1 . though both urls same since sec 1 has http:// in link_to_unless method fails these links . how overcome ? ruby-on-rails link-to

How to connect to a specific wifi network in Android programmatically? -

How to connect to a specific wifi network in Android programmatically? - i want design app shows list of wifi networks available , connect network when selected. have implemented part showing scan results. want connect particular network selected user list of scan results. can please tell me how this? you need create wificonfiguration instance this: string networkssid = "test"; string networkpass = "pass"; wificonfiguration conf = new wificonfiguration(); conf.ssid = "\"" + networkssid + "\""; // please note quotes. string should contain ssid in quotes then, wep network need this: conf.wepkeys[0] = "\"" + networkpass + "\""; conf.weptxkeyindex = 0; conf.allowedkeymanagement.set(wificonfiguration.keymgmt.none); conf.allowedgroupciphers.set(wificonfiguration.groupcipher.wep40); for wpa network need add together passphrase this: conf.presharedkey = "\""+ netwo...

java - serialVersionUID naming convention -

java - serialVersionUID naming convention - is there viable reason why serialversionuid field not named serial_version_uid? according docs java.io.serializable: a serializable class can declare own serialversionuid explicitly declaring field named "serialversionuid" must static, final, , of type long: any-access-modifier static final long serialversionuid = 42l; while referring java naming conventions static final (constants) fields should capitilized having fragments separated underscore. probably because serialversionuid defined in java serialization api before such conventions existed. i found document published sun in 1997 called java code conventions says in section 9 on page 16 "the names of variables declared class constants , of ansi constants should alluppercase words separated underscores (“”)."_ so guess sun didn't enforce own standards on own code. java naming-conventions serializable

ubuntu 9.10 - bash sort ignoring non-alpha characters -

ubuntu 9.10 - bash sort ignoring non-alpha characters - i'm trying extract list of unique tags tagged-text file. tags delimited angle brackets, , each tag name starts colon: <:ttx>, <ol_2> , on. i started adding line-break after each > , tried sort . results baffled me, until realized sort ignoring first 2 characters. is there switch need add, or bbuntu-flavoured bash going sort -d without option? use lang=c disable locale => sort works better: grep -o '<:[a-za-z0-9]>' your-tagged-text-file | lang=c sort bash ubuntu-9.10

Eclipse "Install new Software" option -

Eclipse "Install new Software" option - i new in eclipse, facing problem. install new software alternative not showing in eclipse. eclipse version :- 8.5 please help. thanks , regards deepesh uniyal i think need need utilize help -> myeclipse configuration center described here. update mechanism myeclipse accessed in different way standard eclipse. eclipse

c++ - Inline function as a class method -

c++ - Inline function as a class method - i developed own matrix class. constructor reads matrix file. matrix has free cells , "walls". constructor reads start , finish points breadth first search (to find shortest way start_point finish_point). here code of header: //mymatrix.h file #ifndef __mymatrix_h__ #define __mymatrix_h__ #include <tchar.h> #include <iostream> #include <deque> //using namespace std; #define max_matrix_size 1000 #define free_cell_signification '0' #define ball_signification 'b' #define up_signification 'u' #define down_signification 'd' #define left_signification 'l' #define right_signification 'r' #define start_point_signification 's' #define finish_point_signification 'f' typedef std::pair<int,int> field_point_type; //#define is_right_neighbour_reachable(current_point) (((current_point.second+1) <= column_count)&&((matrix_field[current_poi...

css - Bounce animation won't work -

css - Bounce animation won't work - i'm trying bounce <div> containing image, won't work , i'm not sure why. this code: @keyframes bounce { { left: 0px; } { right: 30px; } } @-moz-keyframes bounce /* firefox */ { { left: 0px; } { right: 30px; } } @-webkit-keyframes bounce /* safari , chrome */ { { left: 0px; } { right: 30px; } } #danielface { background-repeat: no-repeat; width: 145px; height: 165px; background-image: url(../images/daniel/fun.png); animation: bounce 1s; -moz-animation: bounce 1s; /* firefox */ -webkit-animation: bounce 1s; /* safari , chrome */ } that because of 2 things. first left , right won't object given css. values apply if position of element other static (the default). secondly, conflicting values, not animated effect looking for. saying stretch element, except you've given stati...

Are there specific functions that are simply unusable when taking an XPage to mobile devices? -

Are there specific functions that are simply unusable when taking an XPage to mobile devices? - i have application need improve back upwards tablets in future. have seen apps created up1 , extlib mobile controls wondering if knows of specific functionality challenging consider bringing mobile device? for example, there partial refresh issues on specific devices? can managed beans still used behind scenes? dynamic content totally viable on mobile? i'd interested in hearing big challenges/functions people had give when mobilized existing xpage apps. there isn't in xpages prevent building mobile web apps other web app dev models. in other words: can web apps on mobile should able xpages. xpages 8.5.3 up1 comes dojo mobile 1.6.1. not prevent developers using other frameworks jquery or else. there advantages in general native apps , hybrid apps. think of typically rather simple business apps can built mobile web apps. if need local data/offline might differ...

iphone - UIImageView alloc] initWithImage using IBOutlet not working -

iphone - UIImageView alloc] initWithImage using IBOutlet not working - i've typically followed pattern of creating object in method (like viewdidload ), have property hold onto it, release original object created. this: nsarray *myarray = [nsarray alloc] initwithobjects:@"1", @"2", @"3", nil]; self.array = myarray; [myarray release]; i thought same thing uiimageview . have uiimageview created in .xib . have outlet property so @property (nonatomic, retain) iboutlet uiimageview *imageview; in viewdidload , do: uiimageview *imgview = [[uiimageview alloc] initwithimage;[uiimage imagenamed:@"arrow.png"]]; self.imageview = imgview; [imgview release]; if run this, not on screen. however, if in viewdidload instead: [self.imageview setimage:[uiimage imagenamed:@"arrow.png"]]; i arrow image on screen. there different uiimageview missing here? edit because of first response: uiimageview different uitabl...

caching - How to detect stale data in search result with paging? -

caching - How to detect stale data in search result with paging? - let's have rest api search: /items?querystring=foo&pagesize=20&page=3 as search results fetched page after page, search total results might alter , items of each page might vary while browsing through pages. what kind of approaches there observe changes in data? total number of result 1 indication not fool proof. usually there none detection. when come in page, new request done (rest) , recent info page displayed. google says 'about x results in total'. if insist on having counter fixed, have stop calling service 'a rest', take snapshot first search , display disabled entries when user browse pages caching search language-agnostic

vb.net - Search for files over local network servers directorys -

vb.net - Search for files over local network servers directorys - hi want build search programme searches key word on local networks computer workstation has assess search files , folder function on standard windows computer added feature search across networks servers connected to? how can accomplish this? 1) local ip addresses 2) scan local network have access to 3) define computer active on local network 4) looks shared folder on active computer 5) looks hidden share c$, d$, e$, etc... on active computer 6) retry point 4 , 5 using alternative credential (network admin login?) 7) now, search file on remote computer, wolud local file search (enumerate folder in share, enumerate files in folder, looks subfolder... repeat until finished :-) ) vb.net search networking

jquery - 4-Stat CSS Javascript Button -

jquery - 4-Stat CSS Javascript Button - i'm trying working code button. it'll used connect/disconnect. have 4 buttons designed. basic connect button: button which'll shown when page opens. connect button hover effect: button, activated when mouse hovers on it. same text bolder & color more dark. connected button (active): when clicked should remain on state, when click on connect button should changed connected & remain active. now if hover on over connected state should show disconnect button hover @ time & normal if clicked 1 time again means disconnected. my code follows: <html> <head> <title></title> <script type="text/javascript" src="script/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.button').click(function() { $(this).toggleclass('button1').toggleclass('active'); }); }); ...

Understanding Python Numerology -

Understanding Python Numerology - we can not declare integer start 0. >>> n = 08 syntaxerror: invalid token but declare variable contains zeros. >>> n = 00000 >>> print n >>> 0 so question in first case why python not consider value of variable n = 8 ignoring 0 on left side instead of raising exception. in sec case still considering zeros valid value. consider case. >>> n = '0008' >>> print int(n) >>> 8 now in 3rd case still considering valid numeric value, why exception not raised here?? numbers origin 0 , containing no decimal point interpreted octal (using digits 0-7). 08 not valid octal number. according pep index, "the ability specify octal number using leading 0 removed language in python 3.0 (and python 3.0 preview mode of 2.6), , syntaxerror raised whenever leading "0" followed digit" can found here http://www.python.org/dev/peps/pep-3127/ python...

using javascript regex to capture text in a url -

using javascript regex to capture text in a url - i need utilize regular look in javascript match text in url. here example: "qty1=0&qty2=0&qty3=0&" i want match text(number) comes after '=' , before '&' whenever word 'qty' appears in string. text(number) subject alter every time url generated, want match whatever new text(number) may be. what regular look utilize solve this? any help appreciated! var querystr = "qty1=0&qty2=0&qty3=0"; var regex = /qty(\d+)=(\d+)/g; var match = regex.exec(querystr); while(match != null){ var numbeforeequals = match[1]; var numafterequals = match[2]; // comparison, example, if it's > 0: if(numafterequals > 0){ // } match = regex.exec(querystr); } note /g @ end of regex, in javascript implementations end infinite loop without it. javascript

AspectJ compilation with maven throws java.lang.NoClassDefFoundError: org/aspectj/bridge/IMessageHolder -

AspectJ compilation with maven throws java.lang.NoClassDefFoundError: org/aspectj/bridge/IMessageHolder - i next error when trying compile aspectj project. [info] --- aspectj-maven-plugin:1.4:compile (default) @ jetserver --- feb 2, 2012 7:33:31 pm org.sonatype.guice.bean.reflect.loadedclass warning: error injecting: org.codehaus.mojo.aspectj.ajccompilemojo java.lang.noclassdeffounderror: org/aspectj/bridge/imessageholder @ java.lang.class.getdeclaredconstructors0(native method) [error] failed execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project game-server: execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile failed: unable load mojo 'compile' in plugin 'org.codehaus.mojo:aspectj-maven-plugin:1.4'. required class missing: org/aspectj/bridge/imessageholder the relevant part of pom pasted below. ideas why error? <build> <plugins> <plugin> <groupid>o...

java - Space Invaders Clone Movement and Spawning Logic -

java - Space Invaders Clone Movement and Spawning Logic - i making space invaders clone in java. having little problem working out motion , spawning of invaders loop. want them spawn, check border of screen , have basic movement. i know how create images move when single objects, these more 1 obviously. don't want have move each 1 individually create messy code , slow me downwards lot. it grouping of images loaded paintcomponent(graphics g) method. if there basic loop can generate these images , allow me move them in original space invaders great! so far painting invaders so: g.drawimage(invadergreen.draw(), 100, 100, this); g.drawimage(invadergreen.draw(), 100, 100, this); g.drawimage(invadergreen.draw(), 100, 100, this); g.drawimage(invadergreen.draw(), 100, 100, this); g.drawimage(invadergreen.draw(), 100, 100, this); //etc etc. (i aware need alter x , y variables, example.) store invaders within list or array. list<invadergreen> invade...

c - Redistribute bits from byte array to set bits -

c - Redistribute bits from byte array to set bits - i wish move bits 0,8,16,24 of 32-bit value bits 0,1,2,3 respectively. other bits in input , output zero. obviously can this: c = c>>21 + c>>14 + c>>7 + c; c &= 0xf; but there faster (fewer instructions) way? c = (((c&bits_0_8_16_24) * bits_0_7_14_21) >> 21) & 0xf; or wait intel haswell processor, doing in 1 instruction (pext). update taking business relationship clarified constraints , assuming 32-bit unsigned values , code may simplified this: c = (c * bits_7_14_21_28) >> 28; c bit-manipulation

jquery - 'H.length' is null or not an object PIE HTC -

jquery - 'H.length' is null or not an object PIE HTC - anyone know why getting pie script error. 'h.length' null or not object pie htc it happens in ie8 , ie7 i'm using i'm using pie.htc version 1.0beta5 got ideas why happening. update: used pie_uncompressed.htc see if log more details , time 'renderers.length' null or not object (line 4148) anyone run or uncompressed version 'h.length' null or not object. update: again i'm sorry cant post code still having issue. has out there had error before. jquery css3pie

c# - OpenFileDialog InitialDirectory doesn't work -

c# - OpenFileDialog InitialDirectory doesn't work - i have code: openfiledialog dialog = new openfiledialog(); dialog.initialdirectory = getdatapath(...); dialog.autoupgradeenabled = false; dialog.filter = getfilter(...); if (dialog.showdialog(this) == dialogresult.ok) {...} i expect, @ every run, have dialog in same folder - getdatapath(...) folder, remains in lastly selected folder. is right behavior? know how prepare this? if windows saves lastly used path in registry know how find it? edit1: with: dialog.autoupgradeenabled = true; is working expected... edit2: same problem here any known problems getting savefiledialog's initialdirectory property working in windows 7? it may require set restoredirectory openfiledialog dialog = new openfiledialog(); dialog.initialdirectory = getdatapath(...); dialog.restoredirectory = true; dialog.autoupgradeenabled = false; dialog.filter = getfilter(...); if (dialog.showdialog(this) == dialogresult.ok)...

sql - How do I go about optimizing an Oracle query? -

sql - How do I go about optimizing an Oracle query? - i given sql query, saying have optimize query. i came accross explain plan . so, in sql developer, ran explain plan , it divided query different parts , showed cost each of them. how go optimizing query? for? elements high costs? i bit new db, if need more information, please inquire me, , seek it. i trying understand process rather posting query , getting answer. the query in question: select cr.client_app_id, cr.personal_flg, r.requestor_type_id credit_request cr, requestor r, evaluator e cr.evaluator_id = 96 , cr.request_id = r.request_id , cr.evaluator_id = e.evaluator_id , cr.request_id != 143462 , ((r.soc_sec_num_txt = 'xxxxxxxxx' , r.soc_sec_num_txt not null) or (lower(r.first_name_txt) = 'test' , lower(r.last_name_txt) = 'newprogram' , to_char(r.birth_dt, 'mm/dd/yyyy') = '01/02/1960' , r.last_name_txt not null , r.first_name_...

c# - Consuming a .net assembly using asp classic -

c# - Consuming a .net assembly using asp classic - possible duplicate: accessing .net assembly classic asp we have website written in asp classic. in order gradually migrate site asp.net we've decided build class library contains functions wish rewrite in c#. problem having difficulty getting work on asp classic. following tutorials we've: wrote sample class listed below. strongly named our assembly using 'sn -k ourkeyname.key' registered our assembly in gac using 'gacutil /i ourassembly.dll' registered our assembly com using 'regasm /tlb wirecare.dll' upon performing above steps receive next error: server object error 'asp 0177 : 800401f3' server.createobject failed /page.asp, line 2 800401f3 below code .net class: namespace companyname { public class test { public string dotest() { homecoming "test"; } } } and asp page: <% dim cart : s...

add text in a file with python (without replacing it) -

add text in a file with python (without replacing it) - i have file ids , information, this: 1omzgkoaz3o 2011-12-29t01:23:00.000z 9 503 apolloismycopilot nuw1tomcsqg 2011-12-29t01:23:15.000z 9 348 grea7stuff tjulnrracs0 2011-12-29t01:26:20.000z 9 123 adelgaming tyi5g0mnpis 2011-12-29t01:28:07.000z 9 703 preferredgaming and want add together flag on of line, if have dictionary flags = {'1omzgkoaz3o': flag1, 'tjulnrracs0': flag2} the result want 1omzgkoaz3o 2011-12-29t01:23:00.000z 9 503 apolloismycopilot flag1 nuw1tomcsqg 2011-12-29t01:23:15.000z 9 348 grea7stuff tjulnrracs0 2011-12-29t01:26:20.000z 9 123 adelgaming flag2 tyi5g0mnpis 2011-12-29t01:28:07.000z 9 703 preferredgaming so made code l = true while l true: = f.readline() seek a.split(' ')[0] in flags.iterkeys(): f.seek(-1,1) f.write(' '+str(flags[a.split(' ')[0]])+'\n') del flags[a.split(' ')[0]] except indexe...

windows - REG ADD a REG_MULTI_SZ Multi-Line Registry Value -

windows - REG ADD a REG_MULTI_SZ Multi-Line Registry Value - to add together reg_multi_sz multi-line registry value, can do reg.exe add together "hklm\path\to\registry\key" /v registryvalue /t reg_multi_sz /d "abc\0def\0" which add together ("abc", "def"). but if need add together ("abc", "", "def"), i.e. empty item in between? doing reg.exe add together "hklm\path\to\registry\key" /v registryvalue /t reg_multi_sz /d "abc\0\0def\0" gives me "invalid parameter" error. this isn't possible using reg add, because info you're trying set improperly formed. reg_multi_sz values are terminated empty string, having empty string part of value not allowed. if need to, , on understanding software won't able read key correctly, utilize reg import instead. example, next file creates value empty string in middle: windows registry editor version 5.0...

weblogic11g - JDeveloper IntegratedWebLogicServer not able to build default domain -

weblogic11g - JDeveloper IntegratedWebLogicServer not able to build default domain - i trying run jdeveloper integrated weblogic server (11.1.1.5) on windows 7 x64 , maintain running error within jdeveloper: [starting server instance integratedweblogicserver] #### server instance integratedweblogicserver not started: error starting server instance. i found in createdefaultdomain.log file: log file: c:\users\mologan\appdata\roaming\jdeveloper\system11.1.1.5.37.60.13\o.j2ee.adrs\createdefaultdomain.log label: jdevadf_11.1.1.5.0_generic_110409.0025.6013 product home: c:\oracle\middleware\jdeveloper\jdev\ domain: c:\users\mologan\appdata\roaming\jdeveloper\system11.1.1.5.37.60.13\defaultdomain "c:\oracle\middleware\oracle_common\common\bin\wlst.cmd" "c:\users\mologan\appdata\roaming\jdeveloper\system11.1.1.5.37.60.13\o.j2ee.adrs\createdefaultdomain.py" process started elapsed time: 94 ms when seek run command command line follow...

Perl Dynamically Generated Multidimentional Associative Array -

Perl Dynamically Generated Multidimentional Associative Array - this may simple oversight on part (or much more advanced skill set). trying dynamically fill 2d associative array reading input file. my @data; while (<file>) { chomp; $id,$count; print "read: " . $_ . "\n"; #debug 1 ($id,$count,undef,undef,undef) = split /\,/; print "data: " . $id . "," . $count . "\n"; # debug 2 $data{$id}{"count"} = $count; #push @{$data{$id}{"count"}}, $count; print $data{$id}{"count"} . "\n"; # debug 3 } the first print (debug 1) print line similar des313,3,,,. the sec print (debug 2) print line data: des313,3 the 3rd print (debug 3) print blank line. the issue seems in way trying insert info associative array. have tried both direct insert , force method no results. have done php think overlooking in perl. did @ perldoc perldsc page i...

ios5 - XCode 4.2 Storyboard View not connecting to A class -

ios5 - XCode 4.2 Storyboard View not connecting to A class - i have problem storyboard in xcode 4.2. the storyboard runs , have no code errors. i have connected 1 view of app class defining class in 'show identity inspector' area. have iboutlet's in class have been able connect using storyboard view, it's not case view , class not connected. however when seek code on view app won't work. i.e none of methods making changes app. have tried stripping downwards , doing simple, it's not affecting @ all. my thoughts maybe view controller identifier might have include in code, can't find says that. any help fantastic. #import <uikit/uikit.h> #import <mapkit/mapkit.h> #import <corelocation/corelocation.h> @interface mapview : uiviewcontroller <uiapplicationdelegate, cllocationmanagerdelegate> { cllocationmanager *locationmanager; iboutlet mkmapview *mapview; iboutlet uitextfield *text; iboutlet uisegme...

Creating an array in Haskell -

Creating an array in Haskell - i can build array with: array ((0,0),(10,10)) [((x,y),(x)) | x<-[0..10], y<-[0..10]] but can't build function, not simple as: array ((0,0),(10,10)) [((x,y),f(x)) | x<-[0..10], y<-[0..10]] what's wrong this?? specifically, how can convert "x" realfrac? edit - nevermind, using function fromintegral(num) num instead of function (fromintegral num) num . the problem when (x*1.5) , you're forcing x fractional number — such float, double or rational — since (*) takes 2 values of same type , returns value of same type, , of course of study 1.5 fractional number. the problem arises because can't create array indexed floating-point number, things integers, tuples of integers , on.1 mean maintain x , y integers, convert them fractional type calculate value: array ((0,0),(10,10)) [((x,y), fromintegral x * 1.5) | x<-[0..10], y<-[0..10]] here, x , y integers, fromintegral x doubl...

Do something if an image is not loaded (jquery) -

Do something if an image is not loaded (jquery) - i'm looking fade in background image when visitor arrives @ site not when they've got image in cache. along lines of this: check if background image in cache. if show it. if isn't hide , when loads, fade in. using jquery can hide , fade in when loads: $("#bkg img").hide(); $('#bkg img').load(function() { $(this).fadein(); }); but how create conditional happens if image isn't cached? everything i've found on forums triggers when image finishes loading. how can trigger because isn't loaded? thanks help, lernz @sima based on code that other thread i've made far next - doesn't seem having effect. if can see i'm going wrong that'd great: var storage = window.localstorage; if (!storage.cachedelements) { storage.cachedelements = ""; } function logcache(source) { if (storage.cachedelements.indexof(source, 0) < 0) { if (storage.cachedelem...

jsf - IceFaces selectInputDate value changes after -

jsf - IceFaces selectInputDate value changes after - well have ice:selectinputdate value of component not same in backing bean. have select 2 different dates update variable value of backing bean. what missing? cheers ! update what want populate table after getting info db date filter ! please advise ! cheers you should post code improve idea. using valuechangelistener , partialsubmit? if so, if set variable in listener same in bean select inputdate. can populate table listener example: public void datelistener(valuechangeevent evt){ yourdate = (date) evt.getnewvalue(); //get info table } jsf icefaces selectinputdate

How can the type of SQL query parameter be controlled when using a string property in .NET Entity Framework -

How can the type of SQL query parameter be controlled when using a string property in .NET Entity Framework - on database table there column of type char(2) . when utilize parameter in linq such .where(x => x.code == code) sql query parameter translated varchar(max) char(2) in order avoid implicit conversion. because query not using indexes of database in way like. property(c => c.code) .hascolumntype("char") .isfixedlength() .hasmaxlength(2); the code first mapping shown above. thing seems impact translation .hascolumntype("char") doesn't seem impact query translation, influences whether picks varchar(max) or nvarchar(max) . i have thought of 2 solutions, 1 database changed uses int , lookup instead of char code, other convert code utilize expression. 2 things i'd rather not do, if there improve way command mappings sql. i worked out way accomplish this. instead of using .where(x...

SSRS 2008 Web service -

SSRS 2008 Web service - i need on-demand reports name study server ssrs: list of reports , parameters in single web service call? that link specify how in sql server 2005 study server. i have sql server 2008 have tried http://10.230.193.131/reportserver/reportservice2008.asmx?wsdl gives "the path of item 'wsdl' not valid. total path must less 260 characters long; other restrictions apply. if study server in native mode, path must start slash. (rsinvaliditempath) online help" but able see http://10.230.193.131/reportserver/reportservice2010.asmx?wsdl but not able find node names of reports in short how can name of reports consuming service of ssrs 2008 did seek using listchildren method in reportservice2010 web service? http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.listchildren.aspx your question specific using ssrs web service interface, query ssrs tables straight in sql: select [path] ...

Include html file in html using html5 -

Include html file in html using html5 - this question has reply here: html5 include file 8 answers i have 2 html files, suppose a.html , b.html . in a.html want include b.html . in jsf can that: <ui:include src="b.xhtml" /> it means within a.xhtml file, can include b.xhtml . how can in *.html file? using html 5 (if can done @ in html 5). surprisingly, same question asked , possible: html5 include file rafa's answer: use object tag: <object name="foo" type="text/html" data="foo.inc"/> foo.inc should include valid html. i tested on konqueror, firefox , chromium. if find useful (i do), please upvote rafa reply (not mine) because "it not possible" spreading disease. html html5

javascript - refreshing a div element using jQuery in Rails 3 app -

javascript - refreshing a div element using jQuery in Rails 3 app - i have rails 3 app uses resque run long running jobs in background , want create view results on page at moment have scenario working resque runs job , writes info database (updates info entry) progresses. 1 time job finish updates 1 of database entries i.e. sets finish = 1 (complete created value of 0) db schema is create_table "refreshes", :force => true |t| t.string "name" t.string "info" t.integer "complete" t.datetime "created_at" t.datetime "updated_at" end another page view in app display database entry calling it’s controller , displaying latest info on page, view has piece of logic insert standard javascript refresh element if finish value in database not equal 1 view.html.erb <% if @refreshes.complete == 0 %> <meta http-equiv='refresh' content='5'> <%end%> ...

PHP receiving a POST request from Java -

PHP receiving a POST request from Java - edit: shown in website logs xx.xx.xxx.xx - - [27/jan/2012:17:42:24 -0500] "post /dir/adddata2.php http/1.1" 200 - www.mywebsites.com "-" "java/1.7.0" "-" i hosting website @ 1&1, , want have page blank.php should take post request , upload database. think sending post properly, , somehow not handling on website. because nil beingness inserted database. response has content length 0, if send header length of string wont change. alternative host wont allow me remote post requests (still waiting on reply). i send post request java application this: url url = new url("www.mywebsite.com/blank.php"); httpurlconnection request = (httpurlconnection)url.openconnection(); request.setrequestproperty("content-type","application/x-www-form-urlencoded"); request.setrequestmethod("post"); outputstreamwriter post = new outputstreamwriter(request.getoutputstr...