Posts

Showing posts from July, 2011

unity3d - Unity Android Debugging Tips -

today managed build first android application in unity. works nice in editor doesn't work on real android devices used adb logcat try find root of problem. here log: http://pastebin.com/uhae3btb . i'm rather noobish in unity, don't know android java specific functions, i'm quite fond of debugging , don't know start need one. how find app fails adb logcat? possible or should start commenting lines of code, rebuild , see if fails every time? there way of doing this? you have smart reading logs. (i'm sure know though) problem: e/androidruntime( 4994): java.lang.runtimeexception: unable start activity componentinfo{com.vali.atomic/com.unity3d.player.unityplayernativeactivity}: java.lang.illegalargumentexception: unable find native library: main looks me unity not building it's jar file correctly you. ensure android sdk installed correctly , setup within unity. also, ensure 32 bit version of jdk installed , being used unity when compiling

ios - Constraints aren't being added through updateViewConstraints -

i making custom keyboard , have function named setbuttonconstraints() . when insert function viewdidload() , run app constraints set. when move function call override func updateviewconstraints() (which supposed called after subviews have been layed out) no constraints set. cause of this? this simple updateviewconstraints() looks like: override func updateviewconstraints() { super.updateviewconstraints() // add custom view sizing constraints here setbuttonconstraints() } per apple's documentation, updateviewconstraints() gets called if constraints need updated. also, believe need call super.updateviewconstraints() after change constraints. the following link helpful. where should setting autolayout constraints when creating views programmatically

vba - Bringing an Excel window to foreground from Access -

i trying open excel file access , work, excel window pops in background (behind access window), not user friendly. here code use: private function openexcelattachment() dim myxl object set myxl = createobject("excel.application") myxl dim fullpath string, name string name = "\excelfile.xlsx" fullpath = currentproject.path & name .workbooks.open fullpath .visible = true end how can make excel window appear in foreground (on top of opened windows) instead? thank you! i first check open instance of excel. if must allow multiple instances of application, trickier. if ok using 1 instance of excel, think should work using appactivate statement. private function openexcelattachment() dim myxl object on error resume next set myxl = getobject(,"excel.application") if err.number <> 0 set myxl = createobject("excel.application") on error goto 0 myxl dim fullpath string, name string name = "\ex

apache - PHP code is not being executed, instead code shows on the page -

Image
i'm trying execute php code on project (using dreamweaver) code isn't being run. when check source code, php code appears html tags (i can see in source code). apache running (i'm working xampp), php pages being opened php code isn't being executed. does have suggestion happening? note: file named filename.php edit: code..: <? include_once("/code/configs.php"); ?> sounds there wrong configuration, here few things can check: make sure php installed , running correctly. may sound silly, never know. easy way check run php -v command line , see if returns version information or errors. make sure php module listed and uncommented inside of apache's httpd.conf should loadmodule php5_module "c:/php/php5apache2_2.dll" in file. search loadmodule php , , make sure there no comment ( ; ) in front of it. make sure apache's httpd.conf file has php mime type in it. should addtype application/x-httpd-php .php . tells

php - Prepared statement with and without "on duplicate key update" -

i trying remove on duplicate key update because have duplicates. statement work , inserts data not duplicates. please help. $sql = "insert projectselect (id_proj, project, role, id_agent) values ( ?,?,?, ( select idagency agentsinfo email = ?)) on duplicate key update `id_agent` = values(`id_agent`), `project` = values(`project`), `role` = values(`role`) "; if (($stmt = $con->prepare($sql)) === false) { trigger_error($con->error, e_user_error); } $result2= mysqli_query($con, $idq); $row_number = 1; while ($row = mysqli_fetch_array($result2)) { $id_proj= $row["id_proj"]; $project= $row["project"]; $role= $row["role"]; $id_proj++; } if ($stmt->bind_param("ssss", $id_proj, $postproj, $postrole, $_session["email"]) === false) { trigger_error($stmt->error, e_user_error); } if (($stmt->execute()) === false) { trigger_error($stmt->error, e_user_error); } you have understand on duplicate ke

mongodb - How to convert this map reduce in aggregate framework? -

i've still done map/reduce/finalize function using mongodb. this how need mongodb executes aggregation: db.house_results.mapreduce(function(){ emit(this.house_name.tolowercase(),this); },function(key,values){ var house = {name:key,address:"",description:"",photo:[],lat:0,lng:0,rooms:[]}; values.foreach(function(house_val) { /*address*/ if(house.address=="") house.address = house_val.house_address; /*photo*/ if(!house_val.photo in house.photo) house.photo.push(house_val.house_photo); /*description*/ if(house.description=="") house.description = house_val.house_description; /*lat - lng*/ if(house.lat==0 || house.lng==0){ var house_position = house_val.house_position; if(house_position && house_position.lat && house_position.lng){

Grails Reverse Url Mapping: Is there a way to build links based on the currently matched route? -

i'm trying build dynamic url mappings based on domain classes of grails project. goal use single generic controller, url decides domain being used processing. problem now, don't desired urls when using <g:link /> tag. i tried following variants create url mappings: static mappings = { holders.grailsapplication.domainclasses.each { "/admin/${it.propertyname}/$action?/$id?"(controller: "admin") } } static mappings = { "/admin/$domainclass/$action?/$id?"(controller: "admin") } both variants work actual url matching. don't behavior of reverse url mapping grails. in case of variant 1, reverse mapping resolves last added url mapping admincontroller. case 2 have problem have pass domainclass-parameter every link-creating call, though theoretically not necessary, since information present in current request. i know there possibility of using named url mappings , using <g:link mapping="mapping_n

javascript - Show Div when scrolled to top edge not bottom edge -

i using code here need show div when top scrolls view not bottom, how can achieve this? js fiddle $(document).ready(function() { $(window).scroll( function(){ $('.hide').each( function(i){ var bottom_of_object = $(this).position().top + $(this).outerheight(); var bottom_of_window = $(window).scrolltop() + $(window).height(); if( bottom_of_window > bottom_of_object ){ $(this).animate({'opacity':'1'},500); } }); }); }); simple fix. trick .animate() when hit top. right now, you're using var bottom_of_object = $(this).position().top + $(this).outerheight() you don't need $(this).outerheight() because increases y position need scroll height of div . remove have var top_of_object = $(this).position().top $(document).ready(function() { $(window).scroll(function() { $('.hide').each(function(i) { var botto

Rails Serialize: From YAML to JSON - Getting "unexpected token" error -

i used have following code save array of "friends" ids (the facebook user ids imported via graph api , omniauth) user model: class user < activerecord::base ... serialize :friends def self.from_omniauth(auth) require 'net/http' require 'json' where(auth.slice(:provider, :uid, :email, :image)).first_or_initialize.tap |user| user.provider = auth.provider user.uid = auth.uid user.oauth_token = auth.credentials.token friendsinfo = net::http.get(uri("https://graph.facebook.com/" + auth.uid + "/friends?fields=installed&access_token=" + user.oauth_token)) unless friendsinfo == nil friendsdata = (json.parse(friendsinfo))["data"] farr = [] friendsdata.each |fd| if fd["installed"] == true farr.push(fd["id"]) end end end user.friends = farr user.save! end end this code saves user ids of

angularjs - Creating a table header(th) and body(td) from json in angular app -

i have angular app trying create table json. json follows: [ { "campus_id": "321", "name": "0" }, { "campus_id": "231", "name": "1" }, { "campus_id": "123", "name": "2" } ] generally create table in html follows: <table class="table table-striped"> <tr> <th> campus id </th> <th> name </th> </tr> <tr ng-repeat="item in items"> <td > {{item.campus_id}} </td> <td > {{item.name}} </td> </tr> </table> how create headers json instead of defining them ourselves? i add column headers within json result so columndefs: [ {field: 'campus_id

How do I replace a word with a new line and a word using regex with an empty string in Powershell? -

how replace word new line , word using regex empty string in powershell? below sample content... need delete use database , go i'm using powershell , powershell_ise editor: use database_instance go if condition you need match newline , space after newline: /use database_\w+\n\s*\w+/g

Removing a particular string from a given string in C++ -

to remove given substring, buf, a string, strn, in c++, wrote following code: int stpos=strn.find(buf); strn.erase(stpos, buf.length()); but wondering if there's way of doing ignoring spaces between substring or whether substring in lower or upper case. for instance, let's assume strn="ggasfai thekingafs"; buf="iamtheking"; then want output ggas afs i wondering if there's easier way of doing instead of checking going through strn character character (note output, spaces in strn not removed)

ios - -(void) loadView with NSMutableArray -

- (void)loadview { [super loadview]; arrayofimages = [[nsmutablearray alloc]initwithobjects:@"11.jpg",@"22.jpg",@"33.jpg", nil]; uiimageview *awesomeview = [[uiimageview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; [awesomeview setimage :[uiimage imagenamed:[arrayofimages objectatindex:0]]]; awesomeview.contentmode = uiviewcontentmodescaleaspectfit; [self.view addsubview:awesomeview]; nslog(@"%@",[arrayofimages objectatindex:0]); } when put nsmutablearray in -(void)viewdidload , uiimageview displays nothing , nslog shows null. why that? ps. nsmutablearray worked in -(void)loadview . i've declared nsmutablearray *arrayofimage in @interface .h file the way given output "null" in situation arrayofimages null itself. this possible if arrayofimages declared weak variable. but @maddy pointed out, code wrong: don't call s

c# - Live chart using WPF Toolkit Line Series -

i have chart control wpf toolkit. data collection bound line series used in chart dynamic, i.e., new points added collection when receive data. noticed because of this, memory consumption increasing. so, limited number of points displayed in line series 20. following code. code behind: public partial class mainwindow : window { observablecollection<chartdata> lineseries1data; thread mythread; lineseries lineseries; chartdata objchartdata; random r = new random(); lineseries temp; public mainwindow() { initializecomponent(); objchartdata = new chartdata(); lineseries1data = new observablecollection<chartdata>(); addlineseries(); initializedatapoints(); mythread = new thread(new threadstart(startchartdatasimulation)); } private void addlineseries() { lineseries = addlineseries(brushes.tomato); lineseries.dependentvaluepath = "value"; lineser

html - Parse resulting webpage Python Selenium -

i used selenium webdriver in python input text in search field , it. i'd parse page/ use beautifulsoup on it. i'm confused how call resulting page. my code far: textinput = open("1.txt", "r").read() url = "http://www.example.com" driver = webdriver.chrome(executable_path='path/chromedriver.exe') driver.get(url) sbox = driver.find_element_by_name("a") sbox.send_keys(textinput) submit = driver.find_element_by_xpath('//*[@id="maincontent"]/form/input[5]') submit.click() once have clicked on submit button using: submit.click() it automatically goes next page. so, parse resulting page, make another: whatimlookingfor = driver.find_element_by_id("myid") submit = driver.find_element_by_xpath('//*[@id="maincontent"]/form/input[5]') # still on first page submit.click() # on second page whatimlookingfor = driver.find_element_by_id("myid")

c++ - How to map help id of a error messagebox in MFC? -

i have dialog box in mfc has button. able map button content. on dialog box, have edit box user can enter anything. validating edit control box if wrong user enters open error message box display error , having button too. i wanted map error message box helpid content (which different parent dialog box) whenever click button shows me parent content. note: tried both apis afxmessagebox , messagebox. solution side , (i don't know if correct ) create dialog box , mapp id di fro parent dialog box. , treat dialog box error messagebox domodal. i feel can messagebox didn't find on web. what tried - i tried following link couldn't success. http://www.codeproject.com/articles/562/add-a-help-button-to-a-messagebox void callback msgboxcallback(lphelpinfo lphelpinfo) { cstring str = afxgetapp()->m_pszhelpfilepath; afxgetapp()->winhelp(lphelpinfo->dwcontextid); } uint afxmessagebox(hwnd hwnd, lpctstr sztext, uint ntype, uint nidhelp = 0) {

ruby on rails - How is Devise's secret_key used? -

i've been using devise while , have wondered how secret key used. looked through source references secret_key , wasn't clear me it. seems me might related session security? the secret_key in devise used hash passwords , generate hashed tokens (used password-resets, email-confirm tokens etc)

JavaScript array element to string -

i have simple array , want generate string include elements of array, example: the array set follow: array[0] = uri0 array[1] = uri1 array[2] = uri2 and output string must teststring = uri0,uri1,uri2 i've tried make following way (using loop): var teststring = ""; teststring = teststring+array[y] but in firebug console see error message: "teststring not defined" i don't know, i'm doing wrong. can give me hint? you must use join function on array: var teststring = array.join(",");

android - Save state of webpage in webview inside fragment -

using navigation drawer calling webpage inside webview. when moving through menu reloading whole website , again , again. want save state of webpage user left not start of webpage. thanks help. code:- public class facebook extends fragment { // fragment called mainactivity public facebook(){} private webview webview ; private bundle webviewbundle; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.facebook, container, false); webview = (webview) rootview.findviewbyid(r.id.facebook); webview.setwebviewclient(new webviewclient()); webview.getsettings().setloadwithoverviewmode(true); webview.setscrollbarstyle(view.scrollbars_inside_overlay); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setbuiltinzoomcontrols(true); webview.getsettings().setsuppor

Sql complicated order clause -

i have table contains state,city,street etc. , each street there 3 adres. first main, , others replacement1,replacement2. i ordering result city , street. result below city street adrestype sincan plevne st. replacement1 sincan plevne st. main sincan plevne st. replacement2 sincan bosna st. replacement2 sincan bosna st. replacement1 sincan bosna st. main but want adrestype goes periodically below city street adrestype sincan plevne st. main sincan plevne st. replacement1 sincan plevne st. replacement2 sincan bosna st. main sincan bosna st. replacement1 sincan bosna st. replacement2 is possible. assuming 3 columns city , street , adrestype , , sample data 1 row city = sincan, street = plevne st., adrestype = main , can shown below: select city, street, adrestype yourtable order city, street desc, adrestype this first sort in ascending alphabetical order

how to parametrize python sorting -

i have following code in python sorting cursor.execute('select column1, column2, column3 table1'); details = cursor.fetchall() def mixed_order(details): return (details.column1, details.column2, details.column3 ) sorted_details = sorted(details,key=mixed_order) i want parameterize mixed_order function saying criteria1 ="details.column2" criteria2 ="details.column1" criteria3 ="details.column3" and define following def mixed_order(details): return (criteria1, criteria2, criteria3 ) but, python not sorting details. wrong in way defined criteria's , assign columns it. i think want this: def mixed_order(details): return (getattr(details, criteria1), getattr(details, criteria2), getattr(details, criteria3) )

javascript - JQuery won't load from a div -

what i'm trying make stock .html file nav, footer, i'd use on multiple pages , want change easily. small 20ish page site i'm working on , don't want rely on php or something. i've looked @ other responses on here , followed them precisely don't seem me @ all, although it's i'm overlooking. <!doctype html> <html> <head> <link href='files/stylesheet.css' rel='stylesheet' type='text/css'> <meta charset="utf-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> </head> <body> <!--navigation--> <div id='navigation'></div> <script>$("#navigation").load("templete.html #nav");</script> </body> </html> thanks in advance! -shy♥ is cust typo templete.html (third line below). otherwis, take @ jquery docs , restrictions of functions ( http

ruby on rails - Associating nested attributes to user -

i'm trying build small expense tracking app using rails 4.1. using devise authorization. expense , it's nested attribute, comments belong user. associations set in model , expenses getting associated user. here's expense controller: class expensescontroller < applicationcontroller def new @expense = expense.new @item = @expense.items.build #@comment = @expense.comments.build end def index @expenses = expense.all #@items = item.where(:expense_id => @expense.id) end def show @expense = expense.find(params[:id]) @items = item.where(:expense_id => @expense.id) end def create @expense = current_user.expenses.new(expense_params) respond_to |format| if @expense.save expensemailer.expense_submission(@expense).deliver format.html { redirect_to @expense, notice: 'expense report submitted.' } format.js

c++ - passing variable parameter list to syslog -

i try pass variable parameter list function. there similary question: how pass variable number of arguments printf/sprintf me doesn't work. , don't know why. function: void printsyslognotice(const char *fmt, ...) { va_list ap; va_start(ap, fmt); #ifdef __xeno__ rt_syslog(log_notice, fmt, ap); #else syslog(log_notice, fmt, ap); #endif va_end(ap); } when call with: printsyslognotice("%s %i", "hello world", 5); i output: #010 -939524064 needless say, output: hello world 5 does has idea? you should use vsyslog , not syslog . syslog receives variable parameters pack, not va_list . if want call syslog should pass arguments is, not va_list .

Magento - Enable password reset in only 1 shop -

i've been handed website in magento. the website has multiple subdomain shops, , i've been told previous developer removed option customers reset password. client wants enable feature again, note features shall enabled 1 subdomain shop. anyone know should look? p's. i've been told change has been made in 1 of magento files, on ftp server, not via admin area. ok have not provided enough information, try anyway. assuming developer got requirement rewrite controller app/code/core/mage/customer/controllers/accountcontroller.php , modify forgotpasswordaction , resetpasswordaction redirect 404 page, eg $this->_forward('defaultnoroute'); so have see how developer did it, can add store specific check allow 1 website. as making changes live via ftp, hire developer risk breaking website if way. use version controller , development server @ minimum.

compression - Colon in grunt compress task compiles goes as slash -

i use grunt-contrib-compress. this task: compress: { main: { options: { archive: '<%= pkg.name %> <%= grunt.template.today("dd.mm.yyyy hh:mm") %>.zip', mode: 'zip' }, files: [{ src: ['css/**', 'img/**', 'js/**', '*.html'] }] } }, take file name. wrote hh:mm , compressed pkgname 18.08.2014 10/42.zip how make file name colon instead of slash?

javascript - Dojo - removeClass by identifying div using class not working e.g. query('.lb').removeClass('hide'); -

this works: query('#lb').removeclass('hide'); but need remove ".hide" class multiple divs tried this: query('.lb').removeclass('hide'); i'm new dojo. i'm wondering why can select div remove class using id not class. please help! heres html i'm using <div class="lb hide"> <div class="lbc">test</div> <span class="closebtn">close</span> </div> <div id="lb" class="hide"> <div class="lbc">test</div> <span class="closebtn">close</span> </div> here's link jsfiddle of this: http://jsfiddle.net/7xh003o3/ there 2 divs, both ".hide" class. when link clicked, should both have ".hide" class removed , appear on screen. 1 id specified works. your fiddle not have same code, in fiddle have: query('.').remo

parsing - Bash parse HTML -

i have html lots of data , part interested in: <tr valign=top> <td><b>total</b></td> <td align=right><b>54<b></td> <td align=right><b>1<b></td> <td align=right>0 (0/0)</td> <td align=right><b>0<b></td> </tr> i try use awk is: awk -f "</*b>|</td>" '/<[b]>.*[0-9]/ {print $1, $2, $3 }' "index.html" but want have: 54 1 0 0 right getting: '<td align=right> 54' '<td align=right> 1' '<td align=right> 0' any suggestions? awk -f '[<>]' '/<td / { gsub(/<b>/, ""); sub(/ .*/, "", $3); print $3 } ' file output: 54 1 0 0 another: awk -f '[<>]' ' /<td><b>total<\/b><\/td>/ { while (getline > 0 && /<td /) { gsub(/<b>/, ""); sub

php - wordpress search for only single category -

i creating news website @ index page listed news categories created 1 more category 1 of news section recipes want creating search form section filter search recipe category,how can wanted know created normal search.php page per wordpress standard code filter news through out theme. please me out. here code in form page: <div class="search_box"> <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <div class="input-group"> <input type="text" class="form-control search-bar eng my_control" name="s" id="search" placeholder="<?php echo esc_attr_x( 'search &hellip;', 'placeholder', 'dastak' ); ?>" value="<?php echo esc_attr( get_search_query() ); ?>" onfocus="if(this.value==this.defaultvalue)this.value=''

asp.net mvc - Redirect only Mobile devices with 51 Degrees -

i'm using 51 degrees in .net on mvc , it's come attention 51 degrees redirects tablets default classes ismobile. i want redirect mobile traffic, ie phones etc , not tablets. tablets should using default "desktop" layout. is there anyway can use (lite) 51 degrees redirect mobile traffic , not tablet traffic? i don't know normal redirect configuration, can handle on server side. 51degrees adds "istablet" , "issmartphone" properties request.browser. appropriate: var request = httpcontext.current.request; //or wherever you're getting bool smartphoneflag, tabletflag; bool.tryparse(request.browser["istablet"]) bool.tryparse(request.browser["issmartphone"]) if(smartphoneflag && !tabletflag) { //redirect } //else continue on

c# - How to declare var as global which stores value of controls? -

i have 2 radio buttons in criminalityinformationformviewdisposal , i'm finding controls dynamically follows var siahasconvictions = ((radiobuttonlist)criminalityinformationformviewdisposal.findcontrol(contactentity.sia_hascovictions)); var siahasoffencesawatingtrial = ((radiobuttonlist)criminalityinformationformviewtrial.findcontrol(contactentity.sia_hasoffenceawaitingtrial)); now on 1 page whenever need fetch value of radio buttons i.e. whether selected or not every time need define var find control first , check value...now increases code line ..is there way can make findcontrol part global 1 page , access value normal control ,please me out this,as tried declare before page load,,,but gives error gridcontrol there no easy way in opinion, might not repeat code on , on again: private radiobuttonlist siahasconvictions { { return (radiobuttonlist)criminalityinformationformviewdisposal.findcontrol(contactentity.sia_hascovictions); } } with p

python - Major and minor grid lines and ticks using matplotlib -

Image
i have 2 big intergers min=round(raw_min,-5) # negative number max=round(raw_max,-5) from range of interesting ticks: xticks=np.arange(min,max,500000) on x-axis, want have minor ticks (including labels) xticks range. furthermore, want have major tick , grid line @ value 0 . tried add: minorlocator = fixedlocator(xticks) majorlocator = fixedlocator([0]) ax.xaxis.set_major_locator(majorlocator) ax.xaxis.set_major_formatter(formatstrformatter('%d')) ax.xaxis.set_minor_locator(minorlocator) plt.tick_params(which='both', width=1) plt.tick_params(which='major', length=7, color='b') plt.tick_params(which='minor', length=4, color='r') ax.yaxis.grid(true) ax.xaxis.grid(b=true,which='major', color='b', linestyle='-') but doesn't work... no ticks minors , no grid line major. any ideas? seems missing following line: plt.grid(b=true,which='both')

angularjs - Why does AngularFire $remove reload the controller? -

in angular app have table 'contacts', loading contacts firebase database, using angularfire. i'm trying build in uibootstrap pagination directive ( http://angular-ui.github.io/bootstrap/#/pagination ). in contactsctrl set $scope.currentpage = 1; updated when clicked on pagination link, works fine. when delete 1 of contacts following code (this happens in contacts service, btw) contactsctrl reloads, inital $scope.currentpage gets reset , i'm taking page 1 of contacts. $firebase(new firebase(url).$remove(contactid); i'm not looking complete solution - i'm trying understand why $remove causes controller reload better understanding of angular , firebase. in angularfire api docs didn't find on question.

php - How to show images from my database (BLOB type data)? -

this table upload create table `upload` ( `id` int(10) unsigned not null auto_increment, `deskripsi` text, `filetype` varchar(200) default null, `filedata` longblob, `filename` varchar(200) default null, `filesize` bigint(20) default null, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=49 ; this table article create table `info` ( `id_info` int(10) not null auto_increment, `judul_info` varchar(50) collate latin1_general_ci not null, `konten` varchar(50000) collate latin1_general_ci not null, `diubah_oleh` varchar(20) collate latin1_general_ci not null, `id_kategori` int(10) not null, `tgl_buat` timestamp not null default '0000-00-00 00:00:00', `tgl_ubah` timestamp not null default current_timestamp on update current_timestamp, `dibuat_oleh` varchar(20) collate latin1_general_ci not null, `id` int(10) not null, primary key (`id_info`), key `id_kategori` (`id_kategori`), key `id` (`id`) ) engine=myisam

javascript - What does "search" word/command in JS mean? -

i'm reading web workers http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#a-background-number-crunching-worker . there code example word "search". mean? new command? var n = 1; search: while (true) { n += 1; (var = 2; <= math.sqrt(n); += 1) if (n % == 0) continue search; // found prime! postmessage(n); } this labelled continue . while loop has search: label, , continue continue while loop. without label continue for loop.

asset pipeline - Wildcards in javascript manifest -

for asset manifest needed require modes of ace editor in application.js file. looks following: //= require ace/mode-mode1 //= require ace/mode-mode2 //= require ace/mode-mode3 ... is possible use wildcard, include modes @ once? like //= require ace/mode-*

telnet - Telnetlib python write() not working as expected -

i trying automate set of telnet commands used when configuring linux server. trying use python 2.7 , thought telnetlib way go. unfortunatly doesn't work expect. tn = telnetlib.telnet(ip, port) print tn.read_until("syscli>") tn.write("help" +"\n") print tn.read_until("registered components are:", 10) this terminate after 10 seconds printing nothing first print line: "syscli>". have tried different combinations of "carriage return" , "line feed" including "\r", "\r\n", "\n\r", none of them seem help. have suggestion on missing? update: tried code on different server , seems work fine: ip = "www.google.com" port = 80 tn = telnetlib.telnet(ip, port) tn.write("get / http/1.1" +"\n" +"\n") print tn.read_some() so thinking problem server needs special character sending messages. so apparently had misunderstood system bit

c# - Error while editing gridview -

this question has answer here: what nullreferenceexception, , how fix it? 29 answers i have gridview edit , delete . when click edit in row of gridview, object reference not set instance of object in line of code-behind : object reference not set instance of object. imgbtnedit.enabled = true; can please me this? thank in advance. my aspx gridview is: protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { imagebutton imgbtnedit = (imagebutton)e.row.findcontrol("imgbtnedit"); label testing = (label)e.row.findcontrol("testing"); if (!string.isnullorempty(testing.text.tostring())) { imgbtnedit.enabled = true; } } } <asp:templatefield> <itemtemplate> <center>

.net - C# string match based on wildcards -

i getting database exception database 'db_name' cannot opened. in middle of restore try { } catch(exception ex) { if(ex.message.contains("database 'db_name' cannot opened. in middle of restore")){ //show user friendly message } } but problem have around 10-15 database names , keep adding more. how match string has wildcard? is there regex match database '{whatevercomes}' cannot opened. in middle of restore you should handle sqlexception instead of exceptions. differentiate between errors via number property . error 927 . here find all: http://technet.microsoft.com/en-us/library/aa937592(v=sql.80).aspx try { // ... } catch(sqlexception ex) { if(ex.number == 927) { //show user friendly message } } according actual name of database: seems not possible retrieve sqlexception . since message change due localization, why can't handle exception you've opened connection? use sqlconnection.dat

Filtering out all date hours past a point with regex for Google Analytics -

so want send filter query sending google analytics, in way results younger given day , hour for example want results after 2013-03-12-15 (yyyy-mm-dd-hh) my problem in how phrase regex not miss out records okay, despite wrong comment still think easier solve use of index hour (than ga:datehour), ga:nthhour in api. index hour given string of 6 numbers left-padded zeros (first hour 000000, second 000001 etc). results after 2013-03-12-15 set 2013-03-12 start date , filter out results index hour after 15 (or after 14 if want 15 included). you still need regular expression, (imo) easier construct (than expression parses date) . first try be filter ga:nthhour!~00001[0-5]|00000[0-9] where 00001[0-5] filters out index hours ten 15 , 00000[0-9] filter index hour 0 9 (i'm sure can done more elegantly). tested in query explorer , reasonably sure returns desired result.

php - how to access variables in a different controller with Cakephp -

right, have: controller/postscontroller.php model/post.php view/posts/index.ctp the controller finds posts in database , passes values view/posts/index.ctp, foreach though each post. i want able access same posts on controller , view. how do this? postscontroller is; class postscontroller extends appcontroller { public function index() { $this->set('posts', $this->post->find('all')); } } view/posts/index.ctp is; <table> <tr> <th>id</th> <th>title</th> <th>actions</th> <th>created</th> </tr> <!-- here's loop through our $posts array, printing out post info --> <?php foreach ($posts $post): ?> <tr> <td><?php echo $post['post']['id']; ?></td> <td> <?php

response - Fiddler 2: Resend request through FiddlerScript -

hello stackoverflow folks, i'm new fiddler 2, seem getting along pretty good. although have 1 problem can't seem solve. what want simple think. want intercept request, let run, if response doesn't suit me want resend request , make initial request nonexcistent. using fiddlerscript. why useful: in cases send request response different everytime. , want right kind of response. what have far: static function onbeforeresponse(osession: session) { if (osession.uricontains("/stackoverflowexample")) { if(osession.getrequestbodyasstring().contains("getrandomitem")) { if(osession.getresponsebodyasstring().tostring().contains("itemid")) { var body = osession.getresponsebodyasstring(); var item = 0; for(var = 0; i< body.length; i++) { if(i < body.length -7) { if(

PHP Websocket client + ssl -

there php websocket client: https://github.com/symbiose/php-websocket-client repository. , works fine not-secured connection. what need connect websocket server php code through secure connection. implement task took code above , modified bit. connect() method of websocketclient looks in code: public function connect() { $root = $this; if ($this->getport() == 443) { $context = stream_context_create(); stream_context_set_option($context, 'ssl', 'allow_self_signed', true); stream_context_set_option($context, 'ssl', 'verify_peer', false); $client = stream_socket_client("tls://{$this->gethost()}:{$this->getport()}", $errno, $errstr, 30, stream_client_connect, $context); } else { $client = stream_socket_client("tcp://{$this->gethost()}:{$this->getport()}", $errno, $errstr); } if (!$client) { throw new runtimeexception('cannot connect socket ([#'.$errn

angularjs - Angular bootstrap modal how to call service from ok function of the modal? -

i have implemented angular bootstrap modal . below angular code it var modaldemoctrl = function ($scope, $modal, $log) { $scope.items = ['item1', 'item2', 'item3']; $scope.open = function (size) { var modalinstance = $modal.open({ templateurl: 'mymodalcontent.html', controller: modalinstancectrl, size: size, resolve: { items: function () { return $scope.items; } } }); modalinstance.result.then(function (selecteditem) { $scope.selected = selecteditem; }, function () { $log.info('modal dismissed at: ' + new date()); }); }; }; // please note $modalinstance represents modal window (instance) dependency. // not same $modal service used above. var modalinstancectrl = function ($scope, $modalinstance, items) { $scope.items = items; $scope.selected = { item: $scope.items[0] }; $scope.ok = function () { $modalinstance.close($scope.se

java - The implementation of HOG Descriptor -

i trying implement hog descriptor using java without using hog descriptor implemented in opencv, have following questions: are hog detector , hog descriptor same? after extract interest points or key points image extract hog descriptor? form whole image or interest points / key points detected before image. when compute gradient divide image blocks before or after compute image gradient? regards in advance well, i haven't used hog judging other descriptors, not same. actual feature descriptor while detector can guess used detect (to locate) feature. there no point in finding interesting points , extract features whole image. (again) don't know how hog work either extract features whole image or first detect interesting points , extract them. (some features cannot extracted whole image though). judging answers in wikipedia usual approach involves calculation of local features , use blocks group cells larger, spatially connected blocks improve illumin

What are entity types in regards to google cloud endpoints -

i'm new google endpoints , app engine. i'm going on tutorials on google developers site. what entity type? in regards google cloud endpoints. https://developers.google.com/appengine/docs/java/endpoints/paramreturn_types#entity_types towards bottom of link states. "entity types types available method return types or as request body of api request . entity types used resources in rest api. type except parameter or injected type considered entity type. entity types cannot annotated @named, , api request can have 1 body, there can single entity parameter per method. example: public resource set(resource resource) { … }" "entity types types available method return types". mean entity type methods return? api methods return? (i guess might explain next question body of api request) "as request body of api request" mean body of package? doesn't qualify that? what resources? pojo or javabean? read few times don't know is. what

c# - Visual Studio 2012 web console application? (app without graphic UI) -

is in vs this? need create simple server connected db organize data. plan use mobile app. app have own, native grapic interface, don't need html's in project. why asking? because when create new web project, vs automatically creates html&css files, stuff browser needs. won't use browser, need siple console show returned data. something in node.js: single, 1 executable file. what want self-hosted asp.net web api application. self-hosted means running own, minimal web server, no iis required. accomplish this, take @ tutorial: http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api

php - laravel setup different route according to domain/subdomain -

good day, i using laravel build both website , apis mobile backend, api controller setup this: route::controller("api/", "apicontroller"); //mobile apis, response in json and other routes , this: route::controller("/", "maincontroller"); i need setup subdomain apis, instance: http://api.mysite.com to route directly api controller, need because don't want url long , ugly. suggestions ? try using this route::group(array('domain' => 'api.mysite.com'), 'apicontroller');

How to Access Columns generated by projection criteria in Hibernate(pseudo columns)? -

this criteria returns 6 columns. projectionlist projlist = projections.projectionlist(); projlist.add(projections.property("se.ticker"),"ticker"); projlist.add(projections.property("cl.firstname"),"firstname"); projlist.add(projections.property("cl.middlename"),"middlename"); projlist.add(projections.property("tr.client"),"client"); projlist.add(projections.sum("tr.cumulativeqty"),"cumulativeqty"); projlist.add(projections.sum("tr.cumulativebalance"),"cumulativebalance"); projlist.add(projections.groupproperty("tr.securityid")); criteria criteria = createentitycriteria(transactiondetails.class, "tr") .createalias("tr.client", "cl") .createalias("tr.security", "se") .add(restrictions.eq("cl.id", clientid)) .se

javascript - jsPDF dotted line (setLineCap) -

i have question jspdf use generate pdf files. there 1 thing blocked on, it's creation of lines. can using line function, works, apply style on lines, particularly make dotted line. looking in api, found setlinecap(style) function looks 1 looking for, nothing applied on lines. so in code have : doc.setlinecap("round"); doc.line(20, rowposition+4, linewidth, rowposition+4); the line appears right, line. does know how make works ? for additional informations, here api code : /** object providing mapping human-readable integer flag values designating varieties of line cap , join styles. @returns {object} @fieldof jspdf# @name capjoinstyles */ api.capjoinstyles = { 0: 0, 'butt': 0, 'but': 0, 'bevel': 0, 1: 1, 'round': 1, 'rounded': 1, 'circle': 1, 2: 2, 'projecting': 2, 'projec

centos6 - High CPU recources on VPS (centOS) -

i noticed vps running on high recources. @ moment it's running @ 100% on 2 weeks already. when @ processes, command # top list (top 3). top - 14:45:52 93 days, 22:05, 1 user, load average: 1.89, 1.64, 1.57 tasks: 138 total, 2 running, 136 sleeping, 0 stopped, 0 zombie cpu(s): 63.7%us, 35.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 1.3%si, 0.0%st mem: 1020400k total, 736016k used, 284384k free, 116344k buffers swap: 2064376k total, 175280k used, 1889096k free, 204212k cached pid user pr ni virt res shr s %cpu %mem time+ command 13848 myself 20 0 376m 4104 3936 r 48.1 0.4 16502:27 php 13839 root 20 0 169m 1984 1900 s 35.8 0.2 11856:37 crond 2626 myself 20 0 373m 13m 7796 s 16.2 1.4 0:17.31 php the other precesses run on low recources or couple of seconds. can see first 2 processes take 48% , 35% , both running long time! there way better @ running process? maybe needed search harder on internet. fo

ios - iPhone rotation quaternion absolute coordinates? -

i have iphone gyroscope. let's have quaternion of phone rotation q. i want show points on screen relative of world absolute coordinates. every rotation of phone points "still" in real 3d space (sort of augmented reality). let's 4 points forming rectangle. so have created 4 points in 3d space relative phone screen , apply transformation of q each of it. i thought should simple points transformed not relative world coordinates coordinates don't understand, may phone axis related?. please me this? need create new view on screen projection virtual points in absolute 3d space rotated camera. my rotation results seems right long not rotating phone along 'normal' axis (perpendicular screen). rotation on direction results in wrong points translation. pseudocode included. motionmanager.startdevicemotionupdates quaternion q;//quaternion read cmattitude above, relative frame: xarbitraryzvertical var qi=q.conjugate; var vx

c# - Checking internet connection using Task -

i trying execute background task checks internet connection without blocking gui (checking fonction requires 3s check connection). if successful (or not) panel display image (red or green according result). my code : public image iconeconnexion; public image iconeconnexion { { return iconeconnexion; } set { iconeconnexion = value; } } public void mypingcompletedcallback(object sender, pingcompletedeventargs e) { if (e.cancelled || e.error != null) { this.iconeconnexion = windowsformsapplication1.properties.resources.red; return; } if (e.reply.status == ipstatus.success) this.iconeconnexion = windowsformsapplication1.properties.resources.green; } public void checkinternet() { ping myping = new ping(); myping.pingcompleted += new pingcompletedeventhandler(mypingcompletedcallback); try { myping.sendasync("google.com", 3000 /*3 secs timeout*/, new byte[32], new pingoptions(64, true)); }

r - Add horizontal lines, grouped by factor -

Image
i have plot lines, grouped rank factor: ggplot(data=res.sum.df, aes(x=i_id, y=success_rate, colour = rank)) + geom_line(size=1.5, aes(group=rank)) i have additional data.frame object define mean value of values within each rank: > res.sum.df.mean source: local data frame [4 x 2] rank mean_succes_rate 1 1 0.16666667 2 2 0.13735450 3 3 0.13628500 4 4 0.05797931 i add 4 vertical lines of yintercept these mean values, additionaly coloured (grouped) according existing line legend . i tried adding aes argument , other things, combinations failed ( lines not coloured ): ggplot(data=res.sum.df, aes(x=i_id, y=success_rate, colour = rank)) + geom_line(size=1.5, aes(group=rank)) + geom_hline(yintercept = res.sum.df.mean$mean_succes_rate, aes(colour=rank)) you need specify intercepts in aesthetic mapping: geom_hline(data = res.sum.df.mean, aes(yintercept = mean_succes_rate, colour=rank))