Posts

Showing posts from March, 2015

random number generator between 0 - 1000 in c# -

i need in writing program generate 100 random numbers between 0 , 1000. out put needs displayed in windows message box. i'm stuck code have use numbers in box , have 100 random numbers. have tried random integer between 0 , 1000(1000 not included): random random = new random(); int randomnumber = random.next(0, 1000); loop many times want

php - Static variable inside function can't hold reference to singleton -

i've noticed weird behavior singletons in php there's no better way explain example. let's have following singleton class: class singleton { protected function __construct() { // deny direct instantion! } protected function __clone() { // deny cloning! } public static function &instance() { static $instance; echo 'class echo'.php_eol; var_dump($instance); if (!isset($instance)) { $instance = new self; } return $instance; } } and following function: function test($init = false) { static $instance; if ($init === true && !isset($instance)) { $instance =& singleton::instance(); } echo 'function echo'.php_eol; var_dump($instance); return $instance; } and when use following: test(true); test(); singleton::instance(); the output is: class echo null function echo object(singleton)#1 ...

Disable Close Button In Title Bar of a WPF Window (C#) -

Image
i'd know how disable (not remove/hide) close button in wpf window. know how hide makes window's title bar this: but want disable meaning should this: i'm scripting in c# , using wpf (windows presentation foundation). try this: public partial class mainwindow : window { [dllimport("user32.dll")] static extern intptr getsystemmenu(intptr hwnd, bool brevert); [dllimport("user32.dll")] static extern bool enablemenuitem(intptr hmenu, uint uidenableitem, uint uenable); const uint mf_bycommand = 0x00000000; const uint mf_grayed = 0x00000001; const uint mf_enabled = 0x00000000; const uint sc_close = 0xf060; const int wm_showwindow = 0x00000018; const int wm_close = 0x10; public mainwindow() { initializecomponent(); } private void window_loaded(object sender, routedeventargs e) { } protected override void onsourceinitialized(eventargs e) { base...

python - django search function , models are not working -

@login_required def searchproduct(request): """ search particular product name """ search_terms ='' if request.get['search_term']: search_terms = request.get.get('search_term') if search_terms: products = models.product.objects.filter(product_name__icontains=search_terms) product in products: kitchenstyle = kicthenstylemapping.objects.filter(product= product) print kitchenstyle return render_to_response('admin/product/searchlistproduct.html',{'search_terms': search_terms,'products' : products }, context_instance=requestcontext(request)) return httpresponseredirect('/') class kicthenstylemapping(models.model): style_mapping_id = models.autofield(primary_key=true) style = models.foreignkey(kitchenstyle) product = models.foreignkey(product) class meta: ...

onkeydown - android policy phonewindow getSystemService permission denied -

i trying use context.getsystemservice(context.activity_service) to topactivity in onkeydown method of class phonewindow.java .but told "java.lang.securityexception: permission denial: gettasks()" ,how can change permission or code right ? below piece of code protected boolean onkeydown(int featureid, int keycode, keyevent event) { context mcontext; mcontext = getcontext(); activitymanager mactivitymanager = (activitymanager)mcontext.getsystemservice(context.activity_service); componentname mcname = mactivitymanager.getrunningtasks(1).get(0).topactivity; string activityname = mcname.getclassname().tostring(); log.d(tag, "packagename " + activityname); ... } <uses-permission android:name="android.permission.get_tasks" > </uses-permission>

batch file - How to show a data list for created profiles -

i"m new batch file , i'm attempting make rpg i'm looking goes past knowledge of batch file wondering how make system able see profiles/users/data's created decide load,delete,etc. data selecting :datalist cls echo. echo datas echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ echo test echo test02 echo test03 set /p datas=enter= if %datas% == %currentdata% goto ? ^test ^test ^testdata so see... datas --------------- test test02 test03 after select testdata :testdata echo. echo test data echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ echo 1) load current data echo 2) delete current data echo 3) set /p dataoptions=enter= if %dataoptions% equ 1 goto %test%data if %dataoptions% equ 2 del %test%data if %dataoptions% equ 3 goto datalist this see test data -------------- 1) load current data 2) delete current data 3) so need have operate every time make new dat...

javascript - How to generate a custom image in php? -

i looking create product customization tool in php. tool allow user create own customization predefined mobile cover. have mobile cover image , looking allow user write 3 characters written in circle called monogram background color. i not sure how proceed ahead it. looking dynamically create image placed on mobile cover in such way looks part. here link sample image generated http://d13eowy7ljcd3.cloudfront.net/images/ark.png i looking way on how approach , php image handling libraries should make use of. help appreciated. have @ gd , image functions . imagearc there lot of examples out there. you may have @ imagemagick , graphicsmagick.

php - How to use mysqli bind_result -

im trying use mysqli bind_result null values. $stmt number of rows greater 0 have data in it. i dont realy understand value should come bind_result i have read @ manual http://php.net/manual/en/mysqli-stmt.bind-result.php and dont explain should put in bind_result . should put there column names? if yes, strings? how wanted values? here code helping: $sql = "select * comments workout_name = ? , user = ?"; $stmt = $mysqli->prepare($sql) or trigger_error($mysqli->error."[$sql]"); $stmt->bind_param('ss', $workout_name, $user); $workout_name = "rytg"; $user = "tomer"; $stmt->execute(); $stmt->store_result(); $stmt->bind_result($comment, $commented_user); if($stmt->num_rows > 0) { $response["workouts"] = array(); while ($stmt->fetch()) { // temp user array $workouts = array(); $workouts["comment...

ruby - Priority among route patterns -

i have thin server running (without web application framework). in routing pattern, order of matching patterns not seem make difference. whether do: rack::handler::thin.run(rack::builder.new map("/"){...} map("/foo/"){...} end, port: 3000) or rack::handler::thin.run(rack::builder.new map("/foo/"){...} map("/"){...} end, port: 3000) the request localhost:3000/foo/ correctly picked map("/foo/"){...} , not map("/"){...} . how priority determined? for web application frameworks, example in sinatra , says routes matched in order defined. first route matches request invoked , not case setup have app. https://github.com/rack/rack/blob/master/lib/rack/urlmap.rb priority doesn't determined in rack::urlmap. matched full path of resource, provide with map(){ ... }

how to draw transparent cube in silverlight 5 3D? -

i using following code generate 3d cube,but doesn't produce transparent cube.any appreciated. vertexbuffer createcube(graphicsdevice device) { var vertexcollection = new vertexpositioncolor[36]; // front coordinates vector3 cubea = new vector3(-0.75f, 0.75f, 0.75f); vector3 cubeb = new vector3(0.75f, 0.75f, 0.75f); vector3 cubec = new vector3(-0.75f, -0.75f, 0.75f); vector3 cubed = new vector3(0.75f, -0.75f, 0.75f); // coordinates vector3 cubee = new vector3(-0.75f, 0.75f, -0.75f); vector3 cubef = new vector3(0.75f, 0.75f, -0.75f); vector3 cubeg = new vector3(-0.75f, -0.75f, -0.75f); vector3 cubeh = new vector3(0.75f, -0.75f, -0.75f); // colors color cred = color.fromnonpremultiplied(255, 0, 0, 156); //color cred = new color(new vector4(255,0,0,150)); color cgreen = color.fromnonpremultiplied(0, 255, 0, 156); color cblue = color.fromnonpremultiplied(0, 0, 255, 156); color cyellow = color.fromnonpremultip...

python - How to map over a value iff it's distinct from None? -

is there concise way how map on value if , if it's not none ? like def fmapmaybe(f, v): if v not none: f(v) else: none update: i'm looking way how process values, if they're distinct none , , keep none otherwise, semantic fmapmaybe . in above code, f arbitrary 1-argument function , v value should passed f iff it's distinct none . there no further restrictions on v or f are. to give specific example: want string value dictionary , convert integer, if found. result should integer, or none . using above function, i'd write: fmapmaybe(int, os.environ.get('lines')) is there shorter, more concise way? this is, don stewart commented, analogous fmap on maybe functor in haskell, or map on option in scala. (and if consider f can return none , analogous monadic >>= in haskell , flatmap in scala.) if don't tell v , want do, best can come with. if v iterable: result = [f(x) x in v if x != none] ...

ASP.NET MVC - prevent fallback to default route if mandatory parameter specified -

i have following route: routes.maproute( "setpassword", "account/setpassword/{token}", new { controller = "account", action = "setpassword" } ); and want token mandatory. problem if token missing, route falls default one: routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); what want return 404 not found if enters address http://mysite.com/account/setpassword how specify token mandatory parameter , routing must stop @ route if controller , action names match specification? one thing put route constraint on default route, preventing matching actions in account controller: routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", ...

java - Ambiguous output redirect on solaris -

i'm running java program on solaris , want redirect both standout , standerr log file while still keeping them in console. here's command use: java -jar myprogram.jar 2>&1 | tee build.log however, gives me following error: ambiguous output redirect use ksh or bash, (t)csh doesn't support syntax (and possibly not functionality)

SVN server with Apache or Windows service -

i have configure svn server. evaluating 2 approaches with apache. without apache os(windows) service. if go apache, have browser level access too, consider added advantage. what approach should take ? you want apache - flexibility , options logging, authentication , authorization way richer.

windows phone 7 - How to save multiple contact? -

i developing windows phone app require save multiple contact. have store contact in list. want save contact 1 one. here code var data = q in document.descendants("contact") select new contactlist { displayname = q.element("name").value, email = !string.isnullorempty(q.element("email").value) ? q.element("email").value : " ", address = !string.isnullorempty(q.element("address").value) ? q.element("address").value : " ", //phonenumber = m.phonenumbers.firstordefault() phonenumber = !string.isnullorempty(q.element("phonenumber").value) ? q.element("phonenumber").value : " " }; contactlist con = null; savecontactlist = new list<contactlist>(); foreach (var c i...

ajax - Request JSON to load into Javascript object. Differences in response -

take @ function first, notice json file located locally: if (request) { request.open("get", "flicks.json", true); request.onreadystatechange = function() { if (request.readystate == 4) { var testi = request.responsetext; var listmovies = json.parse(testi); console.log(typeof testi); // returns string console.log(typeof listmovies); // returns object - yay! } }; request.send(null); } that's perfect, got wanted, object json data in it. but when changed location of json file , put on server: request.open("get", "http://www.myserver.com/flicks.json", true); then comes error: syntaxerror: json.parse: unexpected end of data example json { "feed": "....", "description": "fake list of netflix movies", "modified": "2010-10-25t15:04:46z", "generator": "i did it...

pdf generation - Inserting scrollable table and DROPDOWN list in pdf through itextpdf in JAVA -

i used itextpdf ver 5.4.2 insert data pdf file. have reached @ problem need insert 1 table in there's lots of rows , want make fixed height scrollable functionality . , added problem need add form fields similar html form fields eg: select,textbox,checkbox etc.(i used other libraries fliyngsaucer html-cleaner change html directly pdf dosen't render select,input , other kind of statement neither makes table scrollable)

session - php request_uri returns image path -

recently started writing url routing script in php urls such: http://www.example.com/messages/drafts to effect using .htaccess file contains following: rewriteengine on rewritebase / rewritecond %{http_host} ^example.co [nc] rewriterule (.*) http://www.example.co/$1 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule . /index.php [l] now templates of requested pages loaded through page class , on pages there switch statements determine command executed... so: http://www.example.com/messages/drafts would be; load messages.php , execute drafts command, must logged in this. if not logged in redirects login page , sets session variable contains error message , previous page restricted. for reason when url contains more /messages or /user_home etc. sets session variable /messages/img/bg.jpg... the ending path image on login page. i set session $_session['last_page'] = $_server['request_uri']; and verify elsewh...

ruby - How to make context menu disappear? -

Image
let's use 'ask question' button of http://www.stackoverflow.com question. suppose, perform context click on 'ask question' button, it'll result appearance of context menu. btn_ask_question = driver.find_element(:css, '.nav.askquestion li') driver.action.context_click(btn_ask_question).perform now, want context menu disappear. how can achieve using selenium webdriver ruby? release method doesn't work. following context menu image: i don't think there built-in handling system level context menu. the easiest might try find body element, click body. driver.find_element(:css, 'body').click

jsp - Is it necessary to use init() in every servlet I use in my web application? -

i have jsp/servlet web application jsp pages , servlets. have read following questions: servlet constructor , init() method using special auto start servlet initialize on startup , share application data they helpful, have new question: need initialize every servlet use? or have init() first serlvet called in web application? because servlet container controls initialization of servlet, don't have choice use init() method initialize instance fields servlet might need. example if servlet depended on service class interact resource, following public class myservlet extends httpservlet { private myservice myservice; public void init() { myservice = new myservice(); myservice.setsomeproperty("propertyvalue"); } ... } this way can initialize fields. if need it, can use init(servletconfig) method instead or call getservletconfig() access servletcontext may contain attributes added either other servlet init() or ser...

java - Stopping only a portion of build script -

i have run problem regarding build script. presently have main build.xml file calls each internal build.xml files directory. internal build.xml has 2 stages execute wherein @ end jar file. requirement if foes wrong in 1st step of internal build.xml file, should not jar file, main build should continue execution , go next internal build.xml file. in internal build.xml based on condition want stop internal build.what changes should make in code stop particular build? in advance. set failonerror="false" on subant tasks you're using call other build files.

java - What is the for(;;){ } syntax? -

this question has answer here: how loop work, for(;;)? 7 answers i've seen in java program following syntax : for(;;){ } what means ? didn't see explanation on internet after researches. is same thing while(true) loop? edit : sorry duplicate, when type " for(;;) " in researches doesn't find information wanted. reply. this: for (;;) { } it's shorthand infinite loop, equivalent this: while (true) { } in fact, show in answer both equivalent @ bytecode level.

ios - __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 18 23 CoreFoundation crash -

i getting following crash. can tell me reason crash? __cfrunloop_is_calling_out_to_an_observer_callback_function__ + 18 23 corefoundation crash i`m not using threads. nszombieenabled , instruments did not clarify reason of crash @ all. please, me. 0 libobjc.a.dylib 0x3b0805be objc_msgsend + 30 1 corefoundation 0x3332130c cfrelease + 96 2 corefoundation 0x333fc430 __cfbasichashdrain + 256 3 corefoundation 0x333213ce cfrelease + 290 4 corefoundation 0x333fc430 __cfbasichashdrain + 256 5 corefoundation 0x333213ce cfrelease + 290 6 imageio 0x34013008 _cgimageplusfinalize + 48 7 corefoundation 0x333213ce cfrelease + 290 8 corefoundation 0x333fc430 __cfbasichashdrain + 256 9 corefoundation 0x333213ce cfrelease + 290 10 imageio 0x34179bb2 releaseinfopng + 18 11 ...

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...

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" ...