Posts

Showing posts from March, 2015

javascript - Why does this JS return false for a non-integer? -

here code function - great jquery cycle plugin function calculatetimeout(currelement, nextelement, opts, isforward) { var index = opts.currslide; return index % 2 ? 2000 : false; } i , working fine the last line curious about. "return" kills function , returns ever output has index variable set in above line (is integer) "% 2" divides index var 2 then "? 2000 : false" short hand if else , if statement true / false return either 2000 or false. so 3 return true , 3.5 return false example. so question why in context integer return true non-integer return false? might have thought number return true , 0 return false? guessing due type casting set? thanks

java - How to increase the height of view in Android? -

i created view middle of layout in android application. want increase height of view pressing binary number on keypad.i don't have idea how implement it.i don't have idea it. how can .can 1 me. here xml file. in advanced. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" android:padding="20dp" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:paddingbottom="20dp" android:text="@string/textstr" /> <view android:layout_width="70dp" android:layout_height="150dp" a

css - Display one DIV directly below dynamically changing DIV -

i have 1 div, changes height depending on data user enters it. once finished, click button , second div appears below data displayed in table. second div on page, it's opacity set 0. as first div can anywhere 100px 1000px in height, how can second div display directly below it? ive been playing around margins , paddings can't second div appear dynamically in right spot. preferably using css if thats option. thanks. you have make sure css position property set relative in divs. like: html: <div class="user_input_data"></div> <div class="results hidden"></div> css: div.user_input_data { position: relative; } div.results { position: relative; } div.hidden { display: none; } div.block { display: block; } then you'd have remove hidden class , add block class show results.

c# - MVC Single Use Controller -

i have 'setup' view , associated controller use configure database , web.config of mvc site after cloning site source control. once it's been run once, want prevent code in 'setup' controller method ever being run again. would programmatically deleting 'setup' view @ end of 'setup' controller method suffice, or there better approach? or there better approach? yes, in setup controller action check if database created , if don't run code, return error or whatever. basically code run if whatever code doing not yet done determine programatically.

iphone - Insert Tab bar at second view of application and tab bar contains more than 5 tabs -

Image
other solution adding 6 tabs acceptable as more 5 tabs have used ciexpandabletabbarcontroller problem is: if add ciexpandabletabbarcontroller this: self.window.rootviewcontroller=ciexpandabletabbarcontroller; there no problem.. but need add second view , views after that.. first view login after first, view tab bar should visible now getting output this: selected tebbar item image not displayed but want output this: i have added tab bar this: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [self maketabbar]; [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationslide]; //============== self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568

Does BigCommerce have any restriction on number of API calls made from one API key or store? -

we have application pulls store details store order details & products, so there chances stores may have 20k orders or more. so wanted know maximum call limit each api, can handle side when limit reached. got reply bigcommerce support, the 20k requests/hour limit store , shared amongst api keys given store.

jwplayer - Full screen effect on jw player 6 -

i want achive effect - http://partyongeorge.ca/template/index6.php i use wordpress , jw player ( version 6.5.3609 ) div called screen , css of screen #screen { color:#fff; margin:0 0 20px; /*position:relative;*/ /*overflow: hidden;*/ background: #333 url(images/loading.gif) no-repeat center center; } im strugling past week make work dont have neccesary skills. you can try using #screen{ position: fixed; left:0; top:0; width:100%; height:100%; } if not suits requirement, provide me link can think. experienced same problem

php - Printing for a combined array to html -

i have 3 arrays print out in nice html format search engines, here foreach loops printing out bing api foreach($jsonobj->d->results $value){ echo "<a href=\"{$value->url}\">{$value->title}</a><p>{$value->description}</p>". "<br>"; } blekko api foreach($js->result $item){ echo "<a href=\"{$item->url}\">{$item->url_title}</a><p>{$item->snippet}</p>". "<br>"; } google api foreach($all_items $item){ echo "<a href=\"{$item->link}\">{$item->title}</a><p>{$item->snippet}</p>". "<br>"; } i created comnined array such below $combined = array(); foreach($bingarray $key=>$value){ if(isset($combined[$key])) $combined[$key]["score"] += $value['score']; else $combined[$key] = array("

Does Go support Inheritence? -

i have heard lot of people talk go, , how not support inheritance. until using language, went along crowd , listened hear say. after little messing language, getting grips basics. came across scenario: package main type thing struct { name string age int } type uglyperson struct { person wonkyteeth bool } type person struct { thing } type cat struct { thing } func (this *cat) setage(age int){ this.thing.setage(age) } func (this *cat getage(){ return this.thing.getage() * 7 } func (this *uglyperson) getwonkyteeth() bool { return this.wonkyteeth } func (this *uglyperson) setwonkyteeth(wonkyteeth bool) { this.wonkyteeth = wonkyteeth } func (this *thing) getage() int { return this.age } func (this *thing) getname() string { return this.name } func (this *thing) setage(age int) { this.age = age } func (this *thing) setname(name string) { this.name = name } now, composes person , cat structs, thing struct. doi

PHP errors - Notice: Undefined index in shorthand if/else -

i know notice: undefined index error lack of isset() . below statements doesn't errors or notices : if (isset($_session['userid'])) { $userid = $_session['userid']; } but following statements, notice: undefined index : $userid = $_session['userid'] ? isset($_session['userid']) : null; please tell me why when using shorthand if/else notice? you doing wrong. should like: $userid = isset($_session['userid']) ? $_session['userid'] : null; first check if variable set use value.

angularjs - Promise in the template engine does not seem to work -

i trying set $scope variable promise , use scope variable in template engine not seem work. in controller: $scope.getuser = function() { // returning promise // need in function angular calls function // more once promise may change if new user logs in, // i.e. myself new return userservice.getmyself(); } service: var userdeferred = $q.defer(); // other code here resolves promise. // have verified promise resolved. service.getmyself = function () { return userdeferred.promise; }; in html: <button> {{getuser().username}} </button> i read angular docs: $q promises recognized templating engine in angular, means in templates can treat promises attached scope if resulting values. but imagine misinterpreted , using wrong. have function return because user change (promise changes) , want template engine pick fact has changed regards promise (ie created new promise user changed , want template see tha

java - finding if the strings in an array is exists in another array -

i have array string[] questions={"adorable", "able", "adventurous"}; , have array t[] contains adjectives. find words adorable, able , adventurous in array t[]. far have line codes doesn't seem work. can please me? string u = sn.nextline(); string[] t = u.split(" "); (y = 0; y <= question.length; y++) { (int w = 0; w < t.length; w++) { if (t[w].equals(question[y])) { system.out.print(t[w] + " "); break; } } } do : for (int y = 0; y < question.length; y++) { } instead of <= . problem outcomes fact don't have question[question.length] element. also, don't see declare y variable. update: here's complete sample: string[] questions = {"adorable", "able", "adventurous"}; string u = "able adorable asd"; string[] t = u.split(" "); (int y = 0; y < qu

Laravel 4 else statement -

i've got problem. blade not executing code within @else statement. here's code (also, it's table): @extends('base') @section('title', 'who online?') @endsection @section('main') <div class="doc-content-box"> <table class="table table-striped table-condensed"> <thead> <tr> <th>#</th> <th>name</th> <th>level</th> <th>vocation</th> <th>date registered</th> <th>role</th> </tr> </thead> <tbody> @if(!empty($results)) <?php $count = 0;?> @foreach($results $result) <?php $count++;?> <tr> <td>{{ $count }}. </td> <td>{{ $result->name }}</td> <td>{{ $result->level }}</td> <td><?php if($result->vocat

android - How to make an exe in mobile that will open my website in mobile browser? -

first of web developer , don't know mobile apps, don't have better words explain problem here want. i have mobile friendly website , want 1 shortcut(this supposed downloaded) on peoples mobile open website in browser. know there different platforms , need make 1 each android fine. advice needed. if want open default browser website can achieved using intent: intent = new intent(intent.action_view); i.setdata(uri.parse("http://example.com")); startactivity(i); but might better encase website in webview better use application being deployed device. http://developer.android.com/guide/webapps/webview.html

ios5 - How to Change App name in iTunes Connect -

is there anyway change app name in itunes connect.previously followed the below procedure change app name, 1. log in itunes connect 2. click "manage applications" 3. click on app 4. click "view details" 5. click on edit (at right of "version information") 6. edit app name. but not working, there way change app name. please give me solution. after confusion managed change app name (while in status 'prepare upload' - not sure if works other statuses): log in itunes connect click "manage applications" click on app click "view details" under current version click on edit next "metadata , uploads" and can edit name.

makefile - make, write a rule for single file -

i need file have dedicated rule use special flags. use $(objdir)/%.$(oe): special_file.c $(echo) "compiling file $< => $@" $(cc) $(cflags) $(cflags_special) $(defines) $(include) $< -o $@ $(objdir)/%.$(oe): %.c $(objdir) $(echo) "compiling file $< => $@" $(cc) $(cflags) $(defines) $(include) $< -o $@ but isn't working special_file.c. seems path not known, when comment special rule , let make files, file compiling fine. how divert make rule 1 file? thanks in advance, you should use target-specific variable values : $(objdir)/special_file.$(oe): cflags += --specific_flags $(objdir)/special_file.$(oe): special_file.c $(objdir)/%.$(oe): %.c $(objdir) $(echo) "compiling file $< => $@" $(cc) $(cflags) $(defines) $(include) $< -o $@

opencv - find curvature at depth map -

Image
i want find curvature @ depth map @ picture this example of curvature maybe if represent image function , take second derivative can find curvatures. couldn't implement it. (i tryed sobel operator opencv) is there way out? ps sorry writing mistakes. english in not native language. that not depth map, point cloud (but assume generated 1 single depth map z = f(x,y). what curvature want estimate? mean, gaussian, whole 2nd fundamental form? see, e.g. here definitions. here's recent reference on fast estimation methods:

javascript - DHTMLX "onEditCell" event called after "onClick" button event -

i have dhtmlxgridobject named mgrid . i have attached validation event: mgrid.attachevent("oneditcell", function(stage, rid, cind, nvalue, ovalue){...}); also have save button: <input type="button" value="save" onclick="onsaveclick();" /> all works fine except 1 situation: if edit data , leaving cursor in cell , click "save" method "onsaveclick" called first , "oneditcell" called. how can perform calling "oneditcell" before "onsaveclick"? this should trick: try closing cell-editor first in onsaveclick() function. trigger oneditcell event. function onsaveclick(){ mgrid.editstop(); //your code... } dhtmlx documentation editstop

Unknown column for calculate field in MySQL -

i having problem in complex query. simplificated version: select sin(3.14) s my_table s < 1 error: #1054 - unknown column 's' in 'where clause' having save you select *,(((acos(sin((".$lat."*pi()/180)) *sin((latitud*pi()/180)) +cos((".$lat."*pi()/180)) * cos((latitud*pi()/180)) * cos(((".$lng."- longitud)*pi()/180))))*180/pi()) *60*1.1515*1.609344) distance pois_data,pois_cat pois_data.idtipo=pois_cat.id , latitud not null having distance <1

sonarqube - Sonar with SQL Server 2008 -

i trying setup sonar 3.6 and/or 3.6.2 sql server 2008. testing in preparation of conversion mysql sql server. getting no errors when running: sonar.sh console console output: running sonar... wrapper | --> wrapper started console wrapper | launching jvm... jvm 1 | wrapper (version 3.2.3) http://wrapper.tanukisoftware.org jvm 1 | copyright 1999-2006 tanuki software, inc. rights reserved. jvm 1 | jvm 1 | 2013-07-31 11:41:12.374:info:oejs.server:jetty-7.6.11.v20130520 jvm 1 | jruby limited openssl loaded. http://jruby.org/openssl jvm 1 | gem install jruby-openssl full support. jvm 1 | 2013-07-31 11:41:43.963:info:oejsh.contexthandler:started o.e.j.w.webappcontext{/,file:/alm/sonar-3.6.2/war/sonar-server/},file:/alm/sonar-3.6.2/war/sonar-server jvm 1 | 2013-07-31 11:41:44.034:info:oejs.abstractconnector:started selectchannelconnector@0.0.0.0:29000 i running database on remote server. should not problem though. i able access server same credent

objective c - Retrieve all contacts phone numbers in iOS -

so far saw methods multiple phone numbers if show picker user can select people , phone number. want retrieving contacts' numbers. possible? try works ios 6 ios 5.0 or older : sample project demo first add following frameworks in link binary libraries addressbookui.framework addressbook.framework then import #import <addressbook/abaddressbook.h> #import <addressbookui/addressbookui.h> then use following code requesting permission access address book abaddressbookref addressbook = abaddressbookcreatewithoptions(null, null); __block bool accessgranted = no; if (&abaddressbookrequestaccesswithcompletion != null) { // on ios 6 dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); abaddressbookrequestaccesswithcompletion(addressbook, ^(bool granted, cferrorref error) { accessgranted = granted; dispatch_semaphore_signal(semaphore); }); dispatch_semaphore_wait(semaphore, dispatch_time_forever);

mysql - how to add a submenu in UberMenu for wordpress directly into the database (out of memory error) -

i using ubermenu in wordpress based website. when try access menus wp-admin. gives me out of memory error. host not powerful enough manage ubermenu all want add 1 sub menu main menu item. considering menu in wp-admin not working, thinking if can directly insert required data/records in wp database. any sugguestion data menus saved. any appreciated. deactivate ubermenu 2 plugin add menu/submenu avtivate ubermenu 2 plugin problems solved.

Adding an Image Frame or Watermark for Video in Android programmatically -

i working on android camera application have capability of image , video capturing. later users can annotate on image , add watermark video. went fine when drawing annotation on image failed no solution. in iphone there avcomposition library draw watermark on videos. don't know whether such library exists android or not know if has come across such requirement , got solution. can 1 guide how started composing image on video. atleast adding text video somewhere

java - How do I set up classes in a Lein project? -

i ran lein new app hm , in hm/src/hm edited core.clj be: (ns hm.core (:gen-class) (:use [hm.hashmap])) (defn -main [] (def j (new hm.hashmap)) (-add j "foo" "bar") (println j)) and hashmap.clj be: (ns hm.hashmap (:gen-class :methods [[hashmap [] java.util.hashmap] [add [string string]]])) (defn -hashmap [] (def h (new java.util.hashmap)) h) (defn -add [this key value] (. put key value) this) the goal make wrapper around hashmap can understand clojure , how ties java. i'm new clojure. however, when compile this, lot of classnotfoundexception in hashmap.clj . how can make work? note: direct answer question. don't recommend learn clojure way. you need compile classes before can run them. in project.clj add map: :aot [hm.hashmap] then need run lein compile in order compile classes. should see output saying hm.hashmap class compiled. after run lein run invoke "main "function in hm

python - Django returns a strange Internal Server Error even though DEBUG=True -

i have strange situation guys. django's debug equal true, when run specific script returns below error, opposed django's standard debug output: internal server error server encountered internal error or misconfiguration , unable complete request. please contact server administrator, ababab@gmail.com , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. apache/2.2.14 (ubuntu) server @ ababab.com port 80 why happening? noticed when remove below code, no errors. view is: import datetime datetime import datetime, date, timedelta def index(): mostviewed = profilevisits.objects.filter(timestamp__gt = datetime.now() - timedelta(7))[0] return httpresponse(mostviewed) i noticed when insert row mostviewed = len(mostviewed) right before bottom row, output of 1 expected. noticed there no errors when iterate through mostviewed , add list. anything point me in right direction appre

c++ - Using class member functions without initialization -

this question has answer here: accessing class members on null pointer 8 answers why possible use class member functions on uninitialized object (at least believe it's uninitialized). following runs without error: // a.h class { public: explicit a(int n) : n_(n) {}; ~a() {}; int foo() { return n_; }; int bar(int i) { return i; }; private: int n_; }; with // main.cc #include <iostream> #include "a.h" int main(int argc, char **argv) { *myclass; std::cout << myclass->bar(5) << "\n"; } now, attempting myclass->foo(); fails, why can use bar() when we've declared pointer a exists, , called myclass ? acceptable coding style/is there ever reason use approach? why can use bar() when we've declared pointer a exists, , called myclass ? because, in general, it's im

android - ListView not getting space to show content on smaller screens -

Image
so developing screen there images , buttons on top , below list view shows list of activity. the design :- now on smaller screen listview height becomes small screen space taken above icons , images. so how can increase height of linearlayout or listview user can scroll see rest of listview. <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > .... other layouts ..... <listview android:id="@+id/listarea" android:layout_width="match_parent" android:layout_height="fill_parent" android:paddingleft="@dimen/list_padding" android:paddingright="@dimen/list_padding" /> </linearlayout> edit: tried using top view header list since want emptyview too, creating problem replaces whole header + listview from read issue, should specify views on top

high performance video output with Qt -

i'm writing video player code decodes video raw ycbcr frames. fastest way output these through qt framework? want avoid copying data around images in hd format. i afraid software color conversion qimage slow , later qimage again copied when drawing gui. i have had @ qabstractvideosurface , have running code, cannot grasp how faster, since in videowidget example ( http://idlebox.net/2010/apidocs/qt-everywhere-opensource-4.7.0.zip/multimedia-videowidget.html ), rendering still done calling qpainter::drawimage qimage, has in rgb. the preferred solution seems me have access hardware surface directly decode ycbcr or @ least directly rgb conversion (with libswscale) into. cannot see how (without using opengl, give me free scaling too, though). one common solution use qgl widget texture mapping. application allocates texture buffer on first frame, call update texture in remaining frames. pure gl call, qt not supporting texture manipulation yet. qglwidget can used contai

Javascript function always returns null -

i newbie javascript world. have doubt how return statement works in javascript. what trying have function pass 1 arguments param , looking whether param match key of exampledata object. if match found want return value , break looping of each function break function don't want execute other statement under each function. if no match found function must return null. function return null value. function examplefunction(param){ $.each(exampledata, function (key, value) { if(key == param){ return value; } }); return null; } any insight highly appreciated. thank you. your example doesn't seem need loop. , returning loop-delegate doesn't you. you can test if key appears in object using in operator. function examplefunction(param){ return param in exampledata ? exampledata[param] : null; }

sql server - Switch Case in SQL Where Clause -

i want use case when statements inside where clause allow different where criteria depending on specific variable. have idea of how looks like, don't know if it's possible or syntax use. i used such: select * table1 case when @var = 1 id = 5 end, case when @var = 2 name = 'bob' end, case when @var = 3 color = 'green' where each instance of @var where condition different. appreciated. you not need case that: select * table1 (@var = 1 , id = 5) or (@var = 2 , name = 'bob') or (@var = 3 , color = 'green')

jquery - how to get a callback refresh function after alert is displayed? -

i try make simple password function in jquery work need to. right now, on page load, prompted enter password see body of page. if password incorrect, alert wrong. works dead there. what need button "try again" in alert refreshes page can try again. how do this? perhaps has solution work? i cant use js fiddle type of task since wouldn't able see code if pass incorrect (therefore not seeing issue). so, must paste code here. hope ok. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>-</title> </head> <body style="display:none;color: #000;"> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

mongodb $regex error: unknown operator -

i'm trying check 1st character of field not a-z db.zips.aggregate( [ { $group : { city: { $regex: '^[a-z]', $options: 'i' }, n : {$sum:1} } } ] ) here sample doc expected found query errors unknown operator '$regex'. mongodb v2.4.5 installed: {"city": "25536", "loc": [-82.076761, 38.087553], "pop": 61, "state": "wv", "_id": "25536"} error: error: printing stack trace @ printstacktrace (src/mongo/shell/utils.js:37:15) @ dbcollection.aggregate (src/mongo/shell/collection.js:897:9) @ (shell):1:9 wed jul 31 12:14:14.737 javascript execution failed: aggregate failed: { "errmsg" : "exception: unknown group operator '$regex'", "code" : 15952, "ok" : 0 } @ src/mongo/shell/collection.js:l898 thanks! p.s. tried also: db.zips.aggregate( [ { $project : { city: /^[a-z]/i }} ,{ $group : { city : "$city&q

ruby on rails - Why is capybara not finding a form element? -

we're trying introduce capybara our rspec examples , aren't having luck yet. don't know if part of confusion between capybara , rails integration testing , but... here's rspec example: require 'spec_helper' describe "planning trip", :type => :feature before :each factorygirl.create(:user) end "creates new trip" visit '/trips/new' save_and_open_page within("#new_trip") fill_in '#trip_from_place_nongeocoded_address', :with => '730 w peachtree st, atlanta, ga' fill_in '#trip_to_place_nongeocoded_address', :with => 'georgia state capitol, atlanta, ga' end click_link 'plan it' expect(page).to have_content 'success' end end and here's relevant part of html, capybara's save_and_open_page: <form accept-charset="utf-8" action="/trips" class= "simple_form form-horizontal"

javascript - rails 3 CSRF token changes just before the POST request -

rails 3 , backbone.js app. the csrf token not change until post form submitted. as form submitted csrf token changes , "warning: can't verify csrf token authenticity" form submitted using ajax. i guess kind of late respond, problem caused missing withcredentials parameter of xhr requests sending backbone.js. if post request not contain session infromation, given new csrf token backend. $.ajax({ type: "post", xhrfields: {withcredentials: true}, //other fields })

vba - MS Access / Outlook 2010 - how to choose which account to send email from? -

i trying send emails specific account sends main no matter how code try or do. there way tell send particular account? writing code in ms access, using outlook objects. sub testemail() on error resume next set outapp = getobject(, "outlook.application") if outapp nothing set outapp = createobject("outlook.application") end if set omail = outapp.createitem(olmailitem) omail .to = "randomaddress@randomdomain.com" .subject = "test2" .send end set outapp = nothing set omail = nothing end sub updated code: option compare database sub testemail() on error resume next set oapp = createobject("outlook.application") set omail = oapp.createitem(olmailitem) set olaccount = oapp.account set olaccounttemp = oapp.account dim foundaccount boolean dim strfrom string strfrom = "fromaddy@randomaddress.com" foundaccount

php - Populate dropdown box won't show up database -

i'm trying populate dropdown box retrieve database mysql . here form , php files below. looks alright me, don't why doesn't show thing when click on submit button . there can fix error? correction , suggestion appreciated. cs_jobs table consists of: job_title , category_code (17, 27, 37....), ...etc. connect.php works fine in case. my form <!doctype html> <html> <head></head> <body> <form action = "csjob.php" method = "post" name = "jobsearch"> <select name = "category_code[]"> <option value = "17">architecture , engineering</option> <option value = "27">arts, design, entertainment, sports, , media</option> <option value = "37">building , grounds cleaning , maintenance</option> <option value = "13">busin

google maps api 3 - Hiding a Marker in StreetView when it wouldn't be visible in the real world -

i'm working on google maps application (v.3) street view component. application takes position data collected mobile device , displays polyline on map , plays corresponding set of street view panoramas recreate user's path. part of this, displaying markers on panorama show path on next handful of steps. this working fine @ stage of development. however, if marker behind/within building or around corner, being rendered such that, example, gives appearance user climbing side of building. determine if marker hidden , prevent rendering. i notice when hovering on panorama, there seems kind of "wall detection" feature going on. haven't found way in documentation, there way detect these walls programmically? have been playing around number of markers show , other strategies work "okay", if possible, best solution. thanks.

jquery read in HTML file and return the file as an object-why doesn't it work? -

i'm wondering if maybe code doesn't work because can't return jquery object function. code doesn't work: var html_file_url = '/solutions1.htm'; var strall = $.get(html_file_url, function (data) { var filedom = $(data); return filedom; }); $("#qapagediv").append(strall.html()); however, code work: var strall = $.get(html_file_url, function (data) { var filedom = $(data); $("#qapagediv").append(filedom); return filedom; }); your problem $.get returns $.deferred().promise() , not return value callback.

Loading spinner relative to jQuery mobile dialog -

is possible have loading spinner, called $.mobile.loading , within jquery mobile dialog, , have position relative dialog? it's not possible directly, in hacky way : on pageinit of dialog, clone <div/> .ui-loader class. var loader = $(".ui-loader").clone(); then add our dialog, : $page.find('[data-role="content"]').html(loader); //$page dialog create class called .ui-loader-altered , add position:relative it. add class loader inside dialog. make loader stay within dialog. $page.find(".ui-loader").addclass("ui-loader-altered"); now you've got dialog, why dont show up? $page.find(".ui-loader-altered").show(); full code : $(document).on("pageinit", "#second", function () { $page = $(this); $(this).on("click", "#show", function () { //clone var loader = $(".ui-loader").clone(); //add dialog $pa

Displaying a text on the last page of crystal report? -

this might naive question not able it. i have simple text object wish display on last page of report after details section , group footer sections displayed. i have tried applying suppress property on page footer work, not happen. tried suppressing text object did not work well. this pushed formula field: if pagenumber = totalpagecount false else true am missing something. any highly appreciated. thanks in advance. try putting text object in report footer section.

javascript - Same URL - render different pages (EXPRESS) -

is possible render different pages same url in express? for example, if click on #login1, want sent /login_page/. if click on #login2, should still sent /login_page/. each time, want render different htmls depending on #login clicked. so want this. client: $("#login1").click(function(){ window.open(/login_page/,'_parent'); }); $("#login2").click(function(){ window.open(/login_page/,'_parent'); }); server: app.get('/login_page/', users.login_page1); //if clicked #login1 app.get('/login_page/', users.login_page2); //if clicked #login2 thanks lot help. basically need field in request convey information. the simple thing: url, web designed if you're cool have urls different, can use query string window.open('/login_page?from=login2', '_parent'); if you're cool query string, set cookie if you're cool cookie, request page via ajax xhr.set

How to pass arguments to PHP function from anchor link -

can pass arguments php function when user clicks on anchor link i.e. tag like: <a href="<?php myfunction($a, $b, $c); ?>">click here</a> and php function in same document like: <?php function myfunction($val1, $val2, $val3) { echo "<br>you passed: ".$val1.",".$val2.",".$val3; } ?> help me please. php server side code , executes there only. executes before sending output requesting client. <a href="<?php myfunction($a, $b, $c); ?>">click here</a> that leave empty href attribute, , call myfunction() (in server side processing) while doing it. if want run php function on user event, need send request server, listen event occurred on page requested, , processing there. for example, link can like <a href="/your/page.php?func=myfunction">click here</a> then in /your/page.php , can check query string in url if(isset($_get[&q

c++ - Meta Regex: test if regex is only a string (no regex "wildcards") -

i have (assumed formed) regex expresion r. want test if regex expression single match (all letters, numbers, , escaped expressions) or swapped else. function, "haswildcards", work this: bool = haswildcards("asdf");//returns false bool b = haswildcards("asdf*");//returns true bool c = haswildcards("asdf[123]");//returns true bool d = haswildcards("asdf\\[123\\]");//returns false i using boost::regex, if helps @ all. thinking of checking if regex expression matches this: (^(([\[\^\$\.\|\?\*\+\(\{\}])))?(\\[qedwsdwsbazzb])?([^\\][\[\^\$\.\|\?\*\+\(\)\{\}])? i've tested on few expressions (using regextest tool of grepwin) so non-escaped regex symbol start, non-escaped flag,non-escaped regex sumbol in body. there alternative? did screw up? there better way? well, there's quick two-step way test this. instead of testing escaped characters and wildcards in 1 regex, first line of function remove escaped characte

comma - MySQL LIKE gives wrong result -

i want create blog , create 2 tables. id name of category i create article table. id category_id article i add each article multiple categories , save id comma separated values in category_id field. i.e. id category_id article 1 1,2,3 xyz 2 1,5 ghjy.............. 3 2,4,6 hgyr.............. now wish post articles on category page. $query = "select * article_table category_id '%category_id%' order id desc"; in above query till there 2 equal looking categories. articles of category 20,21,22,23 etc appear on category page of 2. how avoid this. '%--%' causing problem. my question : wish show articles of different categories on different pages dynamically. can ??? if using mysql, can use find_in_set function see if category wish find exists try: select * article_table find_in_set('searchforid', category_id) > 0 order id desc; where 'searchforid' repl

playframework - Play authenticate (Deadbolt) restrict tag in view script not being processed -

i have working web application uses deadbolt module. every thing working fine except unable add restrict tag view script. have tried.. @@restrict( @@group( "user" ) ) { <p> howdy </p> } #{deadbolt.restrict roles:[['user']]} <p> howdy </p> #{/deadbolt.restrict} both of above displayed on page, text, without interpolation. however following works correctly.... @subjectnotpresent() { howdy } tia, chet it seems trying use deadbolt 1 (which play 1.x) in play 2.x application. instead of deadbolt-1 should use deadbolt-2 . then this: @import be.objectify.deadbolt.java.views.html._ ... @pattern("permission-name") { ... }

python - How to return a str containing key and value in a dictionary -

def dict_to_str(d): """ (dict) -> str return str containing each key , value in d. keys , values separated space. each key-value pair separated comma. >>> dict_to_str({3: 4, 5: 6}) '3 4,5 6' """ how write body of function? so far, have following: for values in d.values(): print(values) items in dict.keys(d): print(items) but don't know how make comes in right format. wanting make each value/item list, can coordinate example, value[0] , item[0], value[1] , item[1] , on use str.join() , list comprehension: ','.join([' '.join(map(str, item)) item in d.iteritems()]) on python 3, replace .iteritems() .items() . map() used make sure both keys , values strings before joining. demo: >>> d = {3: 4, 5: 6} >>> ','.join([' '.join(map(str, item)) item in d.iteritems()]) '3 4,5 6' note order arbitrary; dictionaries not hav

java - Is it worth trying building my own reliability on top of UDP? Or should I just opt for TCP? -

i have never tried program on top of udp know fast and unreliable. question if program reliability on top of udp resulting performance make same using tcp ? i.e. worth try? key point : haven't programmed in udp , try implement reliability first time. there number of commercial solutions provide fast , reliable udp. these cost many $100ks typical installation , can expect spend same on hardware make stable. writing reliable udp harder sounds because sensitive dropped packets. i.e. works fine long lose few packets. for simple installation tcp faster, , simpler trying implement own reliable udp. suggest use udp if don't need reliability.

How to install a program in linux for all users not only for root? -

i installed shrewsoft vpnmanger on linux (crunchbang kernel 3.2.0-4 amd64) problem is, somehow can started sudo. can explain how can fix this? sudo /usr/local/sbin/iked& how can change iked installation available each user? thanks it's paths normal user's shell search commands. makes sense commands located in sbin dir not accessible typing command's name. commands need access protected resources accessible root . but if have luck can gain full rights means of sudo can create alias via alias iked="sudo /usr/local/sbin/iked" and add shell's resource file. to make full command accessible users typing iked can create little bash script named iked content #!/bin/bash sudo /usr/local/sbin/iked and place in /usr/local/bin . of course implies appropriate /etc/sudoers file , execute permission of iked set.

javascript - how to substract two values in jquery -

hi want perform mathematical subtraction in jquery. var whm = $(window).height()/2; var login_height = $("#login").outerheight(); var login_marign = (whm-login_height); but login_margin not work. how subtract value of these 2 variables? what trying do? if trying find margin around login (i assume case looking @ variable name) can use .outermargin() function. $('#login').outerheight(true); finds height of #login div including content, padding, border, , margin $('#login').outerheight(); finds height of #login div including content, padding, border, not margin so find margin around element do var $login = $('#login'); $login.outerheight(true) - $login.outerheight(); this return height of top , bottom margin, , if equal divide 2 find it's value. check out on http://jsfiddle.net/prt2j/1/

Trouble building hello_world with a makefile in Visual C++ -

i following this tutorial on making hello_world program visual c++ 2010 express. hope in doing comfy vc++ , build hello_world program can utilize on handheld ds, stuck @ stage. able follow instructions in tutorial , achieve correct results until reach bit titled "compile project". when click build hello_world, says in tutorial, receive error vc++ : 1>------ build started: project: hello_world, configuration: debug win32 ------ 1> make: *** no targets specified , no makefile found. stop. 1>c:\program files\msbuild\microsoft.cpp\v4.0\microsoft.makefile.targets(38,5): error msb3073: command "make" exited code 2. ========== build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== i have tried going hello_world properties, configuration properties, nmake , changing 'include search path' directory containing makefile, contains source folder hello_world, same build error. please note: quite new vc++ , programming in general, not

jquery - Height of a div not set correctly -

Image
so if open page in chrome http://gameittourney.fyoucon.com you'll see height of 1 not set correct, press on home , how it's supposed be picture without chrome how supposed have no idea why happening jquery $(document).ready(function(){ $("#maincontent").css("height", window.innerheight); $(".leftcontentborder").css("height", $("#maincontent").height()); $(".rightcontentborder").css("height", $("#maincontent").height()); var docheight = $(document).height(); var footerheight = $('#footer').height(); var footertop = $('#footer').position().top + footerheight; if (footertop < docheight) { $('#footer').css('margin-top', 10 + (docheight - footertop) + 'px'); } var mh = $(window).height(); var h = $(document).height(); if( mh < h) { $("#maincontent").css("height", h);

cron job groovy script logging -

i set cron job call groovy script. in groovy script use "ch.qos.logback" logging. if run script manually, logging works fine, when running cron job, there not output log file. has seen similar issue? ahead! since there exact error, try see if: is cron job running same user 1 running script with. the directory/file permissions affect log file generation, verify that. the path when script , when cron jobs runs may different , hence log file may produced @ different place (if using relative path log file) try logging stdout (console appender) , check cron's log (location depending on os using var/log/syslog or var/log/cron or whatever configured)

mySQL bigint to Matlab str -

i using matlab plot aircraft trajectories using mysql database pull flight info. issue matlab not read or store mysql query altitude data. altitude data stored in mysql bigint(20), other data stored doubles in mysql stored in matlab via queries. thought issue when tried convert numeric data string matlab can't data. following error: undefined function 'padarray' input arguments of type 'int8'. error in edu.stanford.covert.db.mysqldatabase/query (line 240) absbytearray = padarray(absbytearray, 8 - numel(absbytearray), 0, 'pre')'; error in writetokml6 (line 115) conflictalt1 = db.query();

validation - Emberjs Autocomplete updates another one -

i have 2 autocomplete fields , need update second autocomplete list first selection. have. using jquery.mixin , validation.mixin input boxes. ng.createinsertblncontroller = ember.objectcontroller.extend(ng.validate,{ content: [] } ng.createinsertblnview = ember.view.extend({ vesselpicker: jq.autocomplete.extend({ source: ng.vessels.autocomplete, minlength: 0 }), voyagepicker: jq.autocomplete.extend({ // jq.autocomplete extends ember.textfield source: ng.voyage.autocomplete, minlength: 0 }) }); ng.vessels = ember.objectcontroller.create({ inputtext: "", autocomplete: function(request, response) { var term = request.term; var self=this; $.getjson( "http://myjsonlink", request, function( data, status, xhr ) { var list = []; $.each(data,function(id,item){ list.push(item.code); }); response( list ); }); } }); ng.voyages = ember.objectcontroller.create({ inputtext: "&q

eclipse - Another GWT module may need to be recompiled -

i'll start other threads i've read: gwt module may need (re)compiled redux some subtlety of gwt compilation - "gwt module may need (re)compiled." google app engine - recompile gwt module gwt maven : module 'xxx' may need (re)compiled i have taken following steps fix this: cleared browser cache. deleted gwt-unitcache folder. deleted *.nocache.js. deleted every file left on previous build. (i did looking @ date , time created.) run both maven clean , gwt:clean on project. compile right clicking on project , going google > gwt compile. run maven package. put war in jboss eap 6.1 (jboss 7) folder. connect , still "gwt module may need recompiled" error. what else causing error come up? this has happened me in past when imported gwt project different computer. seems have done things have tried. before start, right click on project, hit refresh, don't miss that's not in sync file system. there multiple things m

c# - Object-oriented design riddle -

consider have abstract base class inheriting other class x. class override method foo1 . there few other classes a1,a2,a3 concrete classes. all concrete classes inherit method foo1 . method foo1 general algorithm should suitable concrete classes. "almost" because of 1 exception in algorithm there if condition, of classes lets a1,a3 need luanch other method foo2 in start of foo . for a2 don't need launch foo2 . the problem if if implement foo2 in class it's children inherit function well, not design? i thought of excluding foo2 interface implemented concrete classes-> not foo1 calls foo2 on base class! any ideas how solve problem in proper way? thank you the solution use in situation make layer of abstract classes classes need special foo2 derive instead. abstract class : x { public virtual void foo() { //foo logic } } abstract class b : { protected virtual void foo2() { //foo2

regex - Regular expression for removing Postgres SQL data insert (COPY) statements. -

my postgres dump ( pg_dump > file.sql ) contains data want remove. there simple regex (or sed/awk command) delete lines between particular copy table_name statement , termination word ("."). know regex's aren't ideal not matches , multi-line patterns, tried these anyway (in sublime find/replace): "copy ((?!\\[.])*.*)*" "copy ((?!\\[.]$)*(.[\n])*)*" "copy (?!\\[.]$)(.*[\n]*)*" the closest can match first line of data after copy statement: "copy (?!\\[.]$).*[\n]+.*[\n]+" in general, want follows (note poses issues foreign key dependencies in cases: pg_dump -s mydatabase > dump.sql pg_dump -a -t table_i_want1 -t table_i_want2 -t table_i_want3 >> dump.sql the -s flag means --schema-only , -a flag tells "append" (i.e. data only).

authentication - Django TastyPie User Login Returns 501 Not Implemented -

i trying enable user creation , login/logout through ios app. have userresource created , registered. have written login function within resource: class userresource(modelresource): class meta: queryset = user.objects.all() fields = ['username', 'email'] serializer = prettyjsonserializer() authorization = authorization() def login(self, request, **kwargs): self.method_check(request, allowed=['post']) username = request.post['username'] password = request.post['password'] user = authenticate(username = username, password = password) if user: if user.is_active: login(request, user) return self.create_response(request, {'success' : true}) else: return self.create_response(request, {'success' : false, 'reason' : 'disabled'}, httpforbidden) else: return self.create_response(request, {'success' : false