Posts

Showing posts from April, 2013

jasper reports - JasperReports: using variable in variable's expression -

i using jaspersoft studio , trying set variable value of variable (well actually, need sum of 2 variables in variable) so have 2 variables, , b. need put in b. whenever use textfield output a, works fine. if in variable b, put ($v{a}), , try print b, null. does have clue why happens? report x contains subreport y returns variable <returnvalue subreportvariable="expenditures_total_var" tovariable="expenditures_total_var" incrementerfactoryclass=""/> (note same variable name in both reports) report x contains variable <variable name="stotal_var" class="java.lang.double" calculation="sum"> <variableexpression><![cdata[$v{expenditures_total_var}]]></variableexpression> </variable> this works: <textfield> <reportelement x="120" y="1" width="70" height="30" uuid="f0e81b0f-ddd3-4f31-9711-cfdeb64f36b2"/...

c# - Checking possibility of Wifi connectivity with Windows Mobile Pocket PC -

Image
i'm new .net framework 3.5. in c# project i'm using smart device framework . task enable wifi connectivity on button click in windows form (synchronize mobile web part i.e data web mobile) in windows mobile 5.0 pocket pc don't see option wlan connections in settings --> connections following list of network adaptors showing in windows mobile 5.0 pocket pc see when searched i configured ne2000 compatible ethernet driver. am going right way ? also have added opennetcf.net library in reference of project took other stack overflow links , microsoft documentation: building wi-fi discovery application below code snippet : /// check available network interfaces foreach (opennetcf.net.networkinformation.inetworkinterface networkinterface in opennetcf.net.networkinformation.wirelessnetworkinterface.getallnetworkinterfaces()) { /// network interface ne20001 if (networkinterface.description.equals("ne20001")) ...

Storing image in MySQL database -

i want store small (50x50) images avatar images, 1 each user. user uploads image , php resizes/crops 50x50. know how store images blob in database, , know other way store url in db , copy image file server. wondering 1 best practice? think number of users vary in range between 1-200. small images in small numbers, storing method best this? i think,you can choose second way,to store image url in database , retrieve image server,it easy maintaining image , other image re sizing operation

drawing - Android image drawn clipped -

my question is: i've relative layout contains view ( custom view ). in custom view ondraw i draw image bigger view size , center it. problem image clipped on top , left side when perform right pan or down pan cannot see image because it's clipped. do know why? i find clip children if set true left , top border spread on view during panning. thanks

java - Is it possible to create a appxupload without Visual Studio? -

i have desktop app built in java, can create exe innosetup easily. now want upload windows store, , asked me appxupload. i see everywhere need visual studio create this, don't have ... there way create appxupload without visual studio ?

javascript - How do i restrict my node express application to localhost only? -

i have node express application want available localhost client. how can prevent other hosts accessing node express app? when start listening server mentioned host name 'localhost'. take @ following code. var app = require('express')(); app.listen(8000,'localhost');

zend framework2 - zf2 https route not work -

i've zf2 rest web service , route 'geo-province' => array( 'type' => 'segment', 'options' => array( 'route' => '/geo-province[/:id]', 'defaults' => array( '__namespace__' => 'geo\controller', 'controller' => 'geoprovince', ), ), ), if use http works fine not if use https. read need use schema type route not work , in addition it's literal route need segment type route this new route 'geo-province' => array( 'type' => 'schema', 'options' => array( 'route' => '/geo-province', 'scheme' => 'https', 'defaults' => array( '__namespace__' => 'geo\controller', 'controller' => 'geoprovince', 'action'=>'index ...

node.js - Express js route handling -

in application i've set static folder in there 'index.html' file. i want render file on route /profile is possible? yes can this. take @ following code. var app=require('express')(); app.use("/profile", lib.express.static("./public")); here ./public original location of folder containing index.html file.

django - How to create a Factory-Boy factory for a model with TaggableManager field -

how can create field in factory-boy taggablemanager django-taggit? the following not work: first: class experimentfactory(factory.djangomodelfactory): class meta: model = experiment django_get_or_create = ('owner', 'name', 'start_date', 'stop_date', ) owner = factory.subfactory(userfactory) name = factory.sequence(lambda n : 'experiment %s' % n) start_date = fuzzy.fuzzydate(start_date=datetime.date(2003, 2, 1), end_date = datetime.date.today() + timedelta(days=4*52*7+5)) tags = [u'abc, cde', u'xzy'] the error is: typeerror: 'tags' invalid keyword argument function second: (with factory.post_generation ). instead of last line there @factory.post_generation def post_tags(self, create, extracted, **kwargs): self.tags = [u'abc, cde', u'xzy'] # self.save() # not have effects i result experiment.objects.get(pk=1...

php - Recursivly format object -

i have object in format can infinately deep. stdclass object ( [condition] => , [rules] => array ( [0] => stdclass object ( [id] => app [field] => app [type] => string [operator] => equal [value] => files_sharing ) [1] => stdclass object ( [id] => devicetype [field] => devicetype [type] => string [input] => select [operator] => equal [value] => android ) [2] => stdclass object ( [id] => usergroup [field] => usergroup [type] => string [operator] => equal [value] => admin ...

php - Preg matching Arabic? -

i'm attempting preg match link of half in english, half in arabic. the link example looks like: "/<arabic>/123/<arabic>-<english>.html" the basic preg_match('@<a href="/(.*?).html" >); returns arabic within url means no longer identifiable page, returning "دانلود-رایÚ" example. i've attempted things i've seen such \p{arabic} returns nothing. there way able capture these links? it's i'm pretty stumped , can't figure out way around issue. edit add preg match & i'm attempting match. preg_match_all('@<a href="/\p{arabic}/(.*?)/\p{arabic}-(.*?)" >@iu',$page,$link); example text - "a href="/دانلود-رایگان-کتاب/کتاب-های-خارجی/مطلب/2120-the-essential-financial.html" think twice before using regex parse html . $doc = new domdocument(); $doc->loadhtml($yourhtml); $links = $doc->getelementsbytagname('a'); for...

SQL Loop dynamic select "equals" in stored procedure -

i trying following , not understand why not work. not understand. declare @month_1 nvarchar(50) declare @month_2 nvarchar(50) declare @month_3 nvarchar(50) declare @intflag nvarchar(50) set @intflag = 1 while (@intflag <=3) begin select '@month' +'_'+ @intflag = datepart(month, getdate()) print '@month' +'_'+ @intflag set @intflag = @intflag + 1 end go

r - How do I connect the endpoint & startpoint of geom_line in a polar plot (coord_polar)? -

Image
i'm bit stuck getting endpoint of line in polar plot connect startpoint. my data: df <- structure(list(ri = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360), n = c(329l, 315l, 399l, 700l, 919l, 757l, 656l, 918l, 1117l, 976l, 878l, 803l, 811l, 1072l, 1455l, 1642l, 1891l, 1688l, 1553l, 1841l, 2061l, 2321l, 2498l, 2080l, 1595l, 1080l, 1002l, 953l, 729l, 604l, 538l, 489l, 535l, 455l, 328l, 351l, 329l), d = c(0.008581340149717, 0.00821617673909074, 0.0104071572028483, 0.0182581705313128, 0.0239703695975378, 0.0197449072745768, 0.017110514097916, 0.0239442864967787, 0.0291348235478234, 0.0254571063408018, 0.022900962466418, 0.0209447299094916, 0.0211533947155638, 0.0279610840136675, 0.0379509116043715, 0.0428284514463079, 0.0493231435353035, 0.0440282740812228, 0.0405070554787553, 0.0480189884973526, 0.0537572706643366...

angularjs - Is it possible to setup a dynamic child directive? -

would possible setup dynamic child directive within parent directive? in example below, i've used element directive, i'm seeing '' in view child should be. if use attribute directive, '<>' instead. i'm guessing there's maybe better way go this? wanted able use whatever child directive wanted in parent 'tile' directive. definitions // tile .directive('tile', function () { return { replace: true, restrict: 'e', scope: { child: '@', heading: '@', icon: '@' }, templateurl: 'templates/tile.tpl.html', transclude: true }; }) // stats table .directive('statstable', function () { return { replace: true, restrict: 'ae', template: '<h1>table</h1>', }; }); markup <tile child="stats-table" heading="users" icon="user...

Error on ubuntu fresh install -

i trying install ubuntu single os after using dual boot of windows , ubuntu. after installing goes restart when computer comes on gives error failure reading sector 0x4f4818 hd0 any ideas why? you should have @ boot-repair might out. error messages might caused hardware damage, give boot-repair try...

php - Is that possible to get the reference to an array from the referent of its element? -

i have php function, in 1st parameter reference array , 2nd parameter 1 of keys, function fun(&$a, $k) { ...... } i want modify function need pass 1 parameter $a[$k] . inside function , $a can extracted $a[$k] , can call array_search($a[$k], $a) $k . possible in php? function fun(&$ak) { // $ak $a[$k] // php utility extract $a $ak? ... $k = array_search($ak, $a); } short answer: no, there's no way "extract" information, because information doesn't exist in scope of function. long answer: as people have pointed out in comments, cannot this. if have function this: function fun(&$foo) { ... } there no information passed function $foo came from. standalone variable, array element ( $bar[1] ), object property ( $baz->bingo ), or else (think someclass::$bar->baz[$bingo->boingo] ). there's no way tell. to verify this, try var_dump($ak); in function; won't contain information array or object it's in (or ...

string - replace trademark symbol (™) with html code in php -

i have following string: $str='enzyme™ trademark'; now want put string in csv file like: 'enzyme&trade; trademark' , `because if "™" placed in csv file, magento import product setup escapes it. can please me on issue googled lot not found correct suggestion. sorry 4 bad english. i tried following code: htmlentities($db->col['title'], ent_quotes | ent_ignore, "utf-8");//but removes '™'<br> htmlentities($db->col['title'], ent_quotes , "utf-8"); //removes whole string <br> using global function htmlentities in php, can convert string 'special characters' 1 using html entities. $variable = "enzyme™ trademark"; $convertedvariable = htmlentities($variable); echo $convertedvariable; // echos: enzyme&trade; trademark

Xpages @Author showing 2 Authors -

i using following ssjs: var author = @author().tostring(); var str = author.replace("cn=",""); var str2 = str.replace("o=",""); var str3 = str2.replace("[",""); var str4 = str3.replace("]",""); if("" == str4) return @name("[cn]",session.geteffectiveusername()); else return var4; not perfect way it, but... question: why users edited document in field? want show author of document. you list of users because that's @author() returns. here description of function taken online help : " returns names of authors of current document. " you can use @subset() latest author: @subset(@author(), -1) and original author: @subset(@author(), 1) use @name() format name. show common name part of original author, this: @name("[cn]",@subset(@author(), 1))

mercurial - How to merge a reverted change? -

i have following situation, big change pushed main branch mistake (it should have been pushed new branch). searching internet (mainly so) suggested way undo reverting previous revision, did that. started new branch revision posted main 1 mistake. now problem can't merge main branch , new branch because causes many of necessary files new branch deleted. there way keep files new branch while merging main one? ? |\ e f | | c d |/ b | a,b,c,e - main branch d,f - other branch based on revision b c - reverting b a ? - want keep changes d,f branch, can't because reverted of them in revision c i assume instead of 'revert', mean 'backout'? assuming 'c' backout of 'b'? what following: backout 'c' again. 'backout backout', restore contents of 'b' (you may need bit of merging here). after doing backout of 'c', should able merge new branch.

javascript - Sum two values from 2 span elements (the values for each span element can be selected by the user via dropdown) -

i have made 2 forms. user able select value (product) each form price displayed in separate element unique class. when 1 option form selected others hidden. did that. now, can't seem sum values elements . here i've done html: <div id="netpaketi-wrapper"> <strong><p class="textmain"><b>Изберете го Вашиот хостинг пакет</b> </p></strong> <form class="hosting-biranje" action=""> <select name="hosting"> <option value="licen" class="ls" selected="selected">ЛИЧЕН СЕРВЕР</option> <option value="biznisl" class="bl">БИЗНИС l</option> <option value="xl" class="bxl">БИЗНИС xl</option> <option value="xxl" class="bxxl">БИЗНИС xxl</option> </select> </form> <div id="...

java - Why do I get an extra output in my code? -

i'm trying write code gets input array of strings, , creates two-dimensoinal array of type char, number of lines number of words in string , in each line there reversed array of letters in word. for example if input is: start @ end! my output : [t, r, a, t, s] [t, a] [e, h, t] [!, d, n, e] this code: public static void main(string[] args) { char thelist[][] = new char[args.length][]; (int = 0; < args.length; i++) { thelist[i] = new char[args[i].length()]; (int k = 0; k < args[i].length(); k++) { char letter = args[i].charat(args[i].length() - k - 1); thelist[i][k] = letter; } (char[] word : thelist) { string list = arrays.tostring(word); system.out.println(list); } } } the code should : string str ="start @ end!"; string[] splitstring = str.split(" "); int length=0; for(string string:splitstring ){ if(s...

java - This compiles but does not run..any idea why? -

i running on mac , compiles in terminal after type in java lab9 doesn't anything. below put terminal last login: wed nov 12 15:29:48 on ttys000 roberts-macbook-pro-3:~ robertsemulka$ cd /users/robertsemulka/desktop roberts-macbook-pro-3:desktop robertsemulka$ javac lab9.java roberts-macbook-pro-3:desktop robertsemulka$ java lab9 //compiles not run import java.util.scanner; import java.util.random; public class lab9 { public static void main(string[] args) { //create arrays int[] lotterynum = new int[5]; int[] usernum = new int[5]; //create scanner , random objects scanner keyboard = new scanner(system.in); random randomgenerator = new random(); //declare , initialize variable track correct digits int numcorrectdigits = 0; //todo: using for-loop, generate 5 random numbers; store numbers in lotterynum array for(int i=0;i<5;i++) { int randomint = randomgenerator.nextint(10); lotterynum[i] = rand...

javascript - Why does the second for loop need +i? -

i understand of , how works, except: why second loop need "+i"? , why can't replaced "+1"? text = "blah blah blah blah blah blah eric blah blah blah eric blah blah eric blah blah blah blah blah blah blah eric"; var myname = "eric"; var hits = []; // "e" in text for(var = 0; < text.length; i++) { if (text[i] === "e") { // if find it, add characters // length of name array for(var j = i; j < (myname.length + i); j++) { hits.push(text[j]); } } } if (hits.length === 0) { console.log("your name wasn't found!"); } else { console.log(hits); } the j loop offset i . i runs 0 text.length , say, 0 100. whenever "e" found j loops i i + myname.length , instance 50 54. you have j loop 0 myname.length , text[j + i] . note code not "eric" , looks "e" , records next 4 characters. if input string ...

c++ - What happens at a hardware level when I access an element of an array? -

int arr [] = {69, 1, 12, 10, 20, 113}; what happens when int x = a[3]; ???? i under impression a[3] meant like: " start @ memory address arr . walk 3 memory addresses forward. integer represented @ memory address. " but i'm confused how hash tables work. because if hash tables implemented array of "buckets" (like professor says in lecture: https://www.youtube.com/watch?v=upo-m8bzrrc ), still have walk bucket need; hence, no more efficient access array be. can clear me? imagine memory big, two-column table: +---------+-------+ | address | value | +---------+-------+ | ... | ... | +---------+-------+ | 100 | 69 | <-- &arr[0] 100 +---------+-------+ | 101 | 1 | +---------+-------+ | 102 | 12 | +---------+-------+ | 103 | 10 | <-- &arr[3] 103 +---------+-------+ | 104 | 20 | +---------+-------+ | 105 | 113 | +---------+-------+ | ... | ... | +---------+-------+ i w...

tkinter - Python - using tks.color_tints_and_shades -

i new python , looking use tkstuff package generate colour tints. information available here: http://pythonhosted.org/tks/colors.html i have installed , imported colortint (from tks.color_tints_and_shades import colortint) have not been able working. as newbie struggling working script. ideally user input rgb values , have resulting tints returned. alternative (and more complex) read file of rgb values , write file of original colour followed tints. all appreciated! thanks, a edit: i have tried far - try: import tkinter tk except importerror: import tkinter tk tks.color_tints_and_shades import colortint tks.color_var import colorvar colour = (100,150, 200) if __name__ == '__main__': root = tk.tk() root.title('colour tint') entry = colortint(root, colour, count=5, percent=(1,5) ) entry.grid(row=0, column=0, sticky=tk.ew) root.columnconfigure(0, weight=1) root.mainloop() i have started (or attempted start) hard-coded ...

HTML table column not long enough -

i have script generates table 2 'tr'. rows generated (with rails) based on data length of 'td's same. leaves gap of missing td's on either side throws off the style. there way make table appear complete missing cells using css without javascript? http://jsfiddle.net/e8hraszk/1/ <table style="width: 100%"> <tr> <td>item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> </tr> <tr> <td>item 1</td> <td>item 2</td> </tr> </table> what describing not table, it's 2 lists. you should not use <table> element. since didn't give context or code, it's hard determine kind of element do need, it's not <table> .

mysql - copy table data to a different database using stored procedure -

just wondering, im new stored procedures, i tried insert new.emp select * old.users and worked , inserted data of users old table users new emp table. but when did inside stored procedure im getting syntax error create procedure insertnew insert new.emp select * old.users what's difference? in part of query getting syntax error? correct syntax creating stored procedure this: delimiter // create procedure insertemployee() begin insert new.emp select * old.users; end // delimiter ;

How Web server handle TCP connection? -

i tring write small web server. , trying understand how web server should handle tcp connection. my understanding is, client requests arrive @ web server on 80 port. web server has dedicated monitoring thread (or many?) listening on port 80. , monitoring thread put work item each of incoming requests queue later process. work item data should include client ip address , client port info. then worker threads take requests queue , send responses clients. tcp connection tuple < server ip, port 80, client ip, client port > so, question is, can there more 1 monitoring threads? , there multiple queues or single queue synchronized access among multiple monitoring , worker threads? can work items on queue have inter-relationship? if not, mean loss of state of subsequent requests? is possible single port 80 used many worker threads create outbound connection? mean, port 80 used many server worker threads @ same time create tcp connection below. , these connections used send...

php - SQL Selection Based on html input -

how can write sql query based on user select on html interface? example id | acc_type | bill_charge | month | year _________________________________________________________________ 1 | store | 12 | january | 2014 2 | water plant | 11 | january | 2013 3 | store | 51 | february| 2014 4 | pump house | 34 | march | 2014 4 | pump house | 33 | january | 2014 4 | pump house | 5 | january | 2014 4 | pump house | 22 | march | 2013 4 | pump house | 0 | march | 2014 and user in charge of months , year view data right thing can figure redirect different php file have query every single month , in particular month every single year 2014-2020 this: select id , acc_type , bill_charge , month , year acc_info , acc_details , ac...

C++ Cannot allocate an object of abstract type -

i'm new c++ , know error about. code below. questions: i read in post use pointer abstract base class, how do without dynamic allocation? can using reference instead? tried, didn't work. can use union {circle c, shape s};? tried, didn't work. in examples below, circle , square inherit abstract base class shape. int main() { std::vector<shape> shapes; //error! circle c (5); square s(4); shapes.push_back(c); shapes.push_back(s); return 0; } apparently have defined type shape abstract type circle , square types derived shape. what is; std::vector<shape*> shapes ; and store porters squares , circles shapes vector. shapes.push_back (&c) ; shapes.push_back (&s) ;

php - SQL Joining 2 tables with a consideration of a hidden field/flag -

i have 2 tables in db, im trying join using codeignighter, tables categories_has_products products table can list of products visible . if visible == 0, not want these products. the category table irrelevant know category id collect data for, thought id better include the design/table ref. my attempts i have attempted myself little rusty sql $this->db->join('categories_has_products', 'categories_has_products.product_id = products.id', 'left') ->where('visible',1)->get('products'); products id | name | visible ---+------+-------- 1 | abc | 1 2 | def | 1 3 | ghi | 0 4 | jkl | 1 5 | mno | 1 categories_has_products id | category_id | product_id| ---+--------+ 1 | 1 | 1 2 | 1 | 3 3 | 1 | 4 categories id | name | ---+--------+ 1 | fruit | 1 | drinks | expected results id | name | visible ---+------+--------- 1 | abc | 1 4 | jkl | 1 based on res...

javascript - Convert hours to correct division by 60 minutes -

how convert number such following: 12.82 correct hourly format: 13.22 ? this work: timeold = "12.84"; time = timeold.match(/(\d+)(\.\d+)?/); if (time[2] >= .60) { time[2] = time[2] - .60; time[1] = parseint(time[1]) + 1; } alert(time[1] + time[2]);

meteor - NTLM Authentication Failure, 'www-authenticate': 'Negotiate, NTLM' -

i'm writing meteor.js application , need authenticate ntlm server. think i'm of way there; workflow follows: send request server ntlm type 1 message under 'www-authenticate' header, receive (401) response ntlm type 2 message under 'www-authenticate' header (looks 'www-authenticate': 'ntlm tlrmtvn....'), send request server ntlm type 3 message under 'www-authenticate' header, receive (401) response header 'www-authenticate': 'negotiate, ntlm'. this i'm confused; @ step 4, i'd expect receive 200 ok status based off of i've read. however, instead receive 'negotiate, ntlm' in www-authenticate header, i'm not sure about. has else experienced ntlm? on right track here, or indicative totally wrong? edit: before asks, yes, did see this question , in case, have verified credentials correct. i'd know triggers 'negotiate, ntlm' header. are communicating iis server. 'neg...

linux - Enable Thread Safety for Php Version 5.6.2 -

Image
i have below php version installed in linux server. now want run below program - <?php class asyncoperation extends thread { public function __construct($arg) { $this->arg = $arg; } public function run() { if ($this->arg) { $sleep = mt_rand(1, 10); printf('%s: %s -start -sleeps %d' . "\n", date("g:i:sa"), $this->arg, $sleep); sleep($sleep); printf('%s: %s -finish' . "\n", date("g:i:sa"), $this->arg); } } } // create array $stack = array(); //iniciate miltiple thread foreach ( range("a", "d") $i ) { $stack[] = new asyncoperation($i); } // start threads foreach ( $stack $t ) { $t->start(); } ?> i need enable thread safety php installation. can inform me how can ? ok, i asked package maintainer : if want use threaded version of php, on own. while might work fine in specific environment, it's not thread-safe in...

java - Xamarin MultiSelectListPreference InvalidCastException -

currently i'm trying save list of string in shared preferences storage of android. use shared preferences , therefore can use multiselectlistpreference of android itself. saving value not issue, maybe it's cause. issue starts when try read value. @ moment android gives arraylist xamarin code , xamarin should convert c# list. , following invalidcastexception: [monodroid] unhandled exception: [monodroid] system.invalidcastexception: cannot cast source type destination type. [monodroid] @ (wrapper castclass) object.__castclass_with_cache (object,intptr,intptr) <0x00068> [monodroid] @ android.runtime.javaset`1<string>.fromjnihandle (intptr,android.runtime.jnihandleownership) <0x0008f> [monodroid] @ android.content.isharedpreferencesinvoker.getstringset (string,system.collections.generic.icollection`1<string>) <0x0015b> [monodroid] @ canvastix.multiselectlistpreference.ondialogclosed (bool) <0x0009f> [monodroid] @ android.preferences.dialogp...

QDialog exec returning Rejected always -

i have qdialog box accepts password , has ok button. when closing dialog box on "x", function should called. function being called if clicked on ok button. qdialog exec function returning rejected. code: if (password->exec() == qdialog::accepted) { qstring passwordtext = passwordentry->text(); } else { sshdialogboxclosed(); } delete password; in case sshdialogboxclosed() function being called. please me resolve issue. in advance you need connect " ok " button " accept " slot , " cancel " button " reject " slot. qdialog::connect(acceptbutton,signal(clicked(bool)),this,slot(accept())); qdialog::connect(rejectbutton,signal(clicked(bool)),this,slot(reject()));

c++ - Non-copyable elements in vector -

i have non-copyable class (i.e. copy constructor & assignment operator marked 'delete'). keep these in std::vector. it raii class storing pointer or reference not looking for. my knowledge of new initialiser lists & move constructors limited, possible? yes can have std::vector<notcopyable> if notcopyable movable: struct notcopyable { notcopyable() = default; notcopyable(const notcopyable&) = delete; notcopyable& operator = (const notcopyable&) = delete; notcopyable(notcopyable&&) = default; notcopyable& operator = (notcopyable&&) = default; }; int main() { std::vector<notcopyable> v; notcopyable nc; v.push_back(notcopyable{}); v.emplace_back(); v.push_back(std::move(nc)); } live example .

mysql - Select exclude if one row matches -

i'm looking fast way search in table excluding results in join. two simpelfied tabels: table 1 - article_id - term_id table 2 - article_id - loc_id in table 1 there can multiple rows same article_id, can linked multiple terms. i'm looking select query results table 2, loc_id 1 dont have row in table 1 term_id 20. the 2 tables joind on there article_ids ofc. if use normale join, , set on term_id != 20, still results if article linked term_id 19. try below select * table1 t1 join table2 t2 on t1.article_id=t2.article_id t2.loc_id = 1 , t1.term_id <> 20

c# - UserRoles Not Working In Asp.Net -

i trying userroles work in asp.net. facing issues. reason doesn't seem pick roles db. i changing table name meet requirement using following code in identitymodels.cs protected override void onmodelcreating(system.data.entity.dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.entity<identityuserrole>().totable("myrroles"); } at first couldn't find schema , after doing research followed this article , particular error disappeared. following article added following tables in db aspnet_applications aspnet_roles aspnet_schemaversions aspnet_users aspnet_usersinroles which don't need. i'm doing basic if statement check whether roles working of not. , doesn't seem pick roles. if(roles.roleexists("rolename")) { button1.visible = false; } in web.config file have following code <rolemanager defaultprovider="myconn" enabled="true...

Finding time through regex -

i need find retrieve time given text e.g. join dinner tonight til 10pm #lebunsocial @3compasses #e8 #dalston for above condition below code works fine if (regex.ismatch(str, @"(?'hour'\d{2})(?'ampm'am|am|pm|pm|pm)", regexoptions.compiled)) //2 digits + pm/am" (without space) { m = regex.match(str, @"(?'hour'\d{2})(?'ampm'am|am|pm|pm|pm)", regexoptions.compiled); result = true; counter++; } but due business reasons have execute below code well. regex should not match 10pm 1 digit restriction mentioned below still matches below regex. how avoid ? below code should work (for e.g. 1pm) 1 digit if (regex.ismatch(str, @"(?'hour'\d{1})(?'ampm'am|am|pm|pm|pm)", regexoptions.compiled)) // 1 digit + am/pm without space { m = regex.match(str, @"(?'hour'\d{1})(?'ampm'am|am|pm|pm|pm)", regexoptions.compile...

c# - View and Model data formats -

how define format of data used in view , model? i understand viewmodel here data model, convert (if necessary) , supply view (and in opposite direction): user <--> formatted data (converters) <--> view <--> converted data (to used generic view) <--> viewmodel <--> raw data <--> model now problem? want pass operationprogress model view: class operationstep { string _name; bool _iserror; int _time; ... } class operationprogress { list<operationstep> _steps; operationstep _currentstep; // int _currentstepindex; int _currentsteptime; ... } viewmodel converts operationprogress bunch of bindable properties ( list<bool> of errors, current step name , time countdown) , view uses them (and converters!) display progress user. i willing create specialized control handle progress display, avoid same repeatable data conversion primitive types in viewmodels. but fail figure out how define ...

How to add a background image for JPanel in Java Swing -

this question has answer here: how set image background frame in swing gui of java? 7 answers i have ball class moves in circle particle want place background image behind ball panel. you can place jlabel on bottom layer image set icon. make large frame , voila.

android - Use Retrofit to parse text from JSON file in local -

i have json text file in /res/raw . after reading text content, use retrofit parse json text object. seems retrofit accept input file in server. is there anyway reuse retrofit's json parser module in case? you can configure gson instance once , use both local parsing , retrofit via restadapter.builder.setconverter(new gsonconverter(customgson)

javascript - highcharts tooltip not moving next point -

i tried code tool-tip showing starting , end value. want showing tool-tip values. how can show tool-tip values of high-chart? -"from first next other points when hovering" this full code: $(function() { $('#container').highcharts({ chart: { zoomtype: 'y' }, title: { text: 'fleximc' }, xaxis: { type: 'datetime', }, yaxis: { min: 0, //max: 90000, title: { text: 'exchange rate' } }, legend: { enabled: true }, tooltip: { valuedecimals: 2, valuesuffix: '', }, series: [{ type: 'line', name: 'current out', data: [ [date.utc(2014, 10, 12, 18, 33), 0], [date.utc(2014, 10, 12, 17, 42), 0], [date.utc(2014, 10, 12, 16, 40), 10.83], [date.utc(2014, 10, 12, 16, 21), 14.83], [date.utc(2014, 10, 12, 14, 43...

c++ - What are the dangers of floating point exceptions on invalid input? -

i ran fuzzying on dcraw , found floating point exception. what dangers of this? reads length plen corrupted file , computes foo[i % plen] . if plen == 0 undefined standard , gcc throws floating point exception. edit: , exception not caught (this c) , program terminates. should care? there scenario exploited or cause other bad things? 1 possible correct behaviour of code notice file corrupted , exist. how different throwing fpe , exiting? (i'm surprised haven't found question on because seems basic me.) if plen == 0 undefined standard ... exactly. means, compiler free assume doesn't happen. code, example int foo(int m, int n) { if(n == 0) return m % n; return 0; } is compiled to foo: # @foo xorl %eax, %eax ret by clang -std=c99 -s -o2 on machine (intel x86). if branch assumed never entered , foo returns 0 unconditionally. no fpe, no crash. (i couldn't find similar small exam...

Android API or something that analyzes what kind of colors are mostly used in an image? -

Image
i'm seeking way analyze different images in order info whether warm or cool colors used in them part. something following , of shades of course. do have idea how can it? i have drawing program made, looks like: i want analyze paintings. edit: thank :) use official v7 palette library . v7 palette support library includes palette class, lets extract prominent colors image. you might want take @ library: color art

php - Output multiple results with mysqli_fetch_assoc -

what's best way output results select query? if ($result = mysqli_query($con, "select name,pic_url accounts")) { $data = mysqli_fetch_assoc($result); var_dump($data); mysqli_free_result($result); } at present dumping of $data outputs 1 result, though quick check of mysqli_num_rows() shows 2 results (and there 2 rows in table). what's best way output data? i'm looking output name field , pic_url each row hoping receive results array can loop through using foreach you need use loop. while ($data = mysqli_fetch_assoc($result)) { var_dump($data); }

php - Using strlen() with arrays instead of strings -

i want use strlen() compare length of 2 arrays. if length of 1 array greater other, something. unfortunately, noticed strlen() works strings? how can make work arrays? my code: $array1 = array( 'hello world', 'hello world', 'hello world', 'hello world', 'hello world' ); $array2 = array( 'hello world', 'hello world' ); if (strlen($array1) > strlen($array2)) { echo 'it works fool!'; } how can make work arrays? php manual strlen() : strlen() returns null when executed on arrays, , e_warning level error emitted. you can't really. is there reason why "want" this? there function achieve want - count() : count — count elements in array, or in object if (strlen($array1) > strlen($array2)) { echo 'it works fool!'; } don't try work php functions suit needs in sc...

Clear Rows When Doing Multi-responsive Columns - Bootstrap -

Image
that title might not accurate here situation: can see in html, grid system goes 4 images on xl screens to 3 on lg screens 2 on less. i trying display - proper amount of images @ each screen size, is. however, funky going on , can't quite figure out using bootstraps classes. it seems me have add rows dynamically @ each break-point. any suggestions? -- update -- realized col-xl-* doesn't exist. however, not change situation @ all. please disregard xl declaration. -- update 2 -- updated images. -- update 3 -- i'll try clarify goal. specific image attached in post, 3 boxes appear per row - not helter skelter. when collapses down 2 boxes per row (xs device), want make sure every row has 2 boxes. i solved issue adding clearfix elements should be. wanted 3 columns on md , 2 columns on sm , how did it: <div class="row"> <div class="col-sm-6 col-md-4"></div> <div class="col-sm-6 col-md-4...

Javascript not working as per logic -

this question has answer here: how return response asynchronous call? 24 answers i have been struggling last whole night find bug not find. javascript code not working should. var currcab = 0; var cabbooked = 0; function sendmessage(cabid) { if(cabbooked == 1) { return; } // data html page $.post("sendmessage.php",data, function(data,status){ $("#status").html(data); }); } function checkbookingstatus() { var data = "bookingid="+$("#bookingid").val(); $.post("checkbookingstatus.php",data, function(data,status){ // callback here var ans = data.indexof("true"); if(ans!= -1) { console.log("returning true checkbookingstatus"); ...