Posts

Showing posts from August, 2010

java - application should not be shared to other users -

i want make sure once application installed on android device, after retrieving apk device , installing on other devices (by sharing pre installed apk) should not work. thought of using imei, not predefined in application (because may give application several users). i want application usage restricted selective users only . offline application, can't expect check through network. in short words, out of luck here offline app.

html - CSS relative element obstructs float -

code: <style> div { width: 500px; } ul { list-style-type: none; line-height: 1.25em; } ul > li { position: relative; } ul > li:before { content: "\2022"; position: absolute; font-weight: bold; font-size: 30px; line-height: inherit; left: -0.75em; } </style> <div> <span style="float:right"><a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a></span> <ul> <li>the <a href="http://google.com">glowing steel</a> extremely hot , harm touches it. jumping slag bucket instant death, regardless of [[damage threshold]].</li> <li>t

autosuggest - Any working solr suggester example? -

all: i using solr 4.10 default configuration now, wonder if 1 can give me working configuration suggester part? tried example in solr in action, not work(i tried /suggest handler in admin page, keeping other options default specifying keyword in q ). <requesthandler name="/suggest" class="org.apache.solr.handler.component.searchhandler"> <lst name="defaults"> <str name="echoparams">none</str> <str name="wt">json</str> <str name="indent">false</str> <str name="spellcheck">true</str> <str name="spellcheck.dictionary">suggestdictionary</str> <str name="spellcheck.onlymorepopular">true</str> <str name="spellcheck.count">5</str> <str name="spellcheck.collate">false</str> </lst> <arr name="components"> <str>suggest</str> </arr> &l

firefox addon sdk - Unable to check private browsing for Android -

we developing addon android mobile, using sdk1.17, need check private-browsing, unable this. of have gone through many documentation pages check private window state/detection none of solution working in case of android firefox. below implementation tried 1. require('sdk/private-browsing/utils').ignorewindow(window) : returning false when opted private browsing , nothing return in case of private window mode when not opted private browsing 2. require("sdk/private-browsing").isprivate(tab) : returning false when opted private browsing 3. checked other solutions on other forums device details on checking: 1. samsung - s4 2. android 4.4.2 3. firefox nightly build 39.0a1 could please suggest solution below expectations? 1. want detach content script private window in onattach event of page-mod 2. want identify if request/response from/to private window (while intercepting request/response using observer)

z3py - Z3 taking too long for a non-linear real formula -

why take unspecified large time z3 solve following non-linear real formula? instantly solves if first constraint changes < 0 > 0. the formula: s.add (0.9993612667+0.0014*x^2+0.0014*y^2+0.0014*z^2-0.0023*x^2*y^2-0.0023*x^2*z^2-0.0023*y^2*z^2+0.0010*x^4*y^2+0.0011*x^2*y^4+0.0011*x^3*y^2*z+0.0011*x^4*z^2+0.0034*x^2*y^2*z^2+0.0011*x*y^3*z^2+0.0010*y^4*z^2+0.0011*x^2*y*z^3+0.0010*x^2*z^4+0.0011*y^2*z^4 < 0,x>=-1,x<=-0.1,y>=-1,y>=-0.1,z>=-1,z<=-0.1 ) ok, have sorted out problem running iterative loop on ranges of x,y , z.that means,instead of asking z3 solve problem whole ranges of x,y,z, used partitioning of these ranges instead, , iteratively found sat/unsat of inequality.

android - Site parsing and opening with slow internet connection -

i making network app works few news sites. have option view , download articles (for reading in future). there no fast mobile internet in country (mostly 2g speed 15 kb/sec) , app doesn't work slow connect though it's perfect fast connection. have seen logs can't establish connection. when try open article doesn't load @ or goes infinite loading. when try save article saves blank file. how can track these mistakes , catch them? , correct ways of handling it? i suppose code irrelevant works correctly wi-fi. think need add lines, not edit them ok, need manage information good, need define package size download, need webservices allow manage information 1 one, example need design packages no more 500kb size download, when package downloaded can show in mobile , continue downloading next package in background. 500kb example need test maximum data size download , create packages in web services

batch file - How can I create a bootable dvd with custom DOS boot script? -

we have bootable usb stick works perfectly. boot, ask user options, write files hard drive accordingly. did using rufus-2.1, throwing freedos usb stick, , hijacking autoexec.bat. autoexec.bat executes separate .bat scripts based on user input. the problem is, want have option allow users burn iso cd or dvd. we've been trying create image of usb stick , burn dvd. we found plenty of information on subject, nothing has worked. started extracting bootimage various bootable iso files using imgburn. none of these worked. tried extracting bootimage our usb stick, , didn't work. next tried winimage. extracted boot information boot98.exe, hijacked autoexec.exe, created new image , injected files. saved files bootimage , tried above method again, didn't work. is there perhaps more straightforward way execute dos .bat scripts through cd/dvd boot? we'd open other dos well, long can write files hard drive based on user input through simple boot interface. note: compute

Concrete5 5.7: Using file objects in a Single Page Controller -

try attach file object mail object. i have included following in form of view: $f = new concrete\core\application\service\filemanager(); //... echo $f->file('file', 'test', 'pls choose'); then submit form controller. there (btw other form fields arrive in controller expected) do: $files = $this->post('test'); $file = \file::getbyid($files); which should return file object. when do $file = \file::getrelativepathfromid($files); it gives me correct path chosen file. so far good. when try send mail file object attached: $mail = loader::helper('mail'); $mail->settesting(false); $mail->setsubject('test-subject'); $mail->to($this->post('uemail')); //... $attach = $mail->addattachment($file); $attach->filename = 'tttt'; $mail->sendmail(); the following error occurs: call_user_func_array() expects parameter 1 valid callback, class

semantics - Describe a film (entity and attribute) using the first order logic -

good morning, want understand how can describe using first order logic. for example want describe film (an entity) , attribute (for example actor: clooney) film. how can describe using first order logic? ******* update ******** what need explain in first logic order is: entity : element, abstraction or object can described set of properties or attributes. think must says entity has got set of attributes respective values. entity describes element, abstraction or object. attribute : attribute has got value , associated entity. describes specific feature/property of entity. document : pure text description (pure text not contains html tags). every document describes 1 entity through attribute. to state object has property use single place predicate. example, state x film write film(x) . if want attribute value object can use 2 (or more) place predicate. using example clooney starred in film starred(clooney, x) . there conventions people use. example, predicate

javascript - Can PHP set cookie function, Overwrite cookie value created with JQuery cookie -

i trying have 1 set cookie , value of cookie gets overwritten php when user logs in, creates separate cookie, here snippet of code setting cookie value <?php include("db_connect.php"); $input_game = $_post['game']; $input_user = $_post['email']; $sql = "update users_table set pref_game = '" . $input_game . "' email='" . $input_user . "'"; if ($conn->query($sql) === true) { $cookie_name2 = "content"; $sql="select pref_game users_table email='$input_user'"; $result = $conn->query($sql); $row = $result->fetch_object(); setcookie($cookie_name2,$row->pref_game, time() + (86400 * 30), "/"); // 86400 = 1 day } else { //error } ?> below jquery cookie code clarity: $("#test-cookie").click(function() { $.cookie('content', 'test'); location.reload(); }); is there anyway php can update/overwrite cookie value created

r - Boxplot with continuous and discrete x variables -

Image
i trying make box plot without faceting. data this: species elevation hbl datae 400 83 datae 300 92 datae 257 92 datae 350 102 datae 500 89 datae 625 100 datae 625 94 datae 632 87 datae 1000 100 datae 940 89 datae 1050 98 datae 550 79 datae 700 102 datae 638 86 abrae 1500 71 abrae 1600 80 abrae 1405 80 abrae 1470 90 abrae 1000 77 abrae 1125 88 abrae 1125 82 abrae 1132 75 abrae 1500 88 abrae 1440 77 abrae 1550 86 abrae 1050 67 abrae 1200 90 abrae 1138 74 abrae 1000 83 abrae 1100 92 abrae 905 92 abrae 970 102 abrae 500 89 abrae 625 100 abrae 625 94 abrae 632 87 abrae 1000 100 abrae 940 89 abrae 1050 98 mingan 1000 120 the code below produces box plot pools hbl values 2 species of interest when both present in single bin of elevation, giving red (abrae), blue (datae), , grey (both), separate boxes each species in bins, on same plot. missing? library(ggplot2) d = read.csv("path_to_file") p = ggplot(d[d$species=="abrae" | d$species=="datae",], aes(x=e

Linux ELF file: How to get the shared object belonging to an imported function -

given dynamically linked elf binary, example /bin/less . inside binary, there call function provided shared library, example strcpy() how can find out shared library/shared object strcp function obtained? in other words, want pairs func_name/shared_obj_name.so. answering this post , michael slade wrote: elf files don't specify symbols come libraries; adds list of shared libraries link elf binary, , lets linker find symbols in libraries. yet there must way gather required info (using linker). executing binary , ltrace-ing not option in case. tried far: i tried objdump -t /bin/less | grep strcpy gives me: 0000000000000000 df *und* 0000000000000000 glibc_2.2.5 strcpy 0000000000000000 df *und* 0000000000000000 glibc_2.3.4 __strcpy_chk this neither unambigious nor give me name of .so file. running ldd /bin/less , returning: linux-vdso.so.1 => (0x00007ffe8b7fa000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f92c23a

one control with different background color in different styles in android -

i have 2 activity: activity1 , activity2 theme of activity1 blue , other 1 orange now have xml layout (sort_items.xml) inflated in these activities i want layout's background color blue when open activity1 , orange when open activity2. i created 2 style in styles.xml: <style name="appthemeorange" parent="@style/theme.appcompat.light.darkactionbar"> <item name="actionbarstyle">@style/myactionbarorange</item> </style> <style name="appthemeblue" parent="@style/theme.appcompat.light.darkactionbar"> <item name="actionbarstyle">@style/myactionbarblue</item> </style> and these themes attributed activitoes in manifest.xml also 2 color in colors.xml <color name="orange">#ffa726</color> <color name="blue">#119eff</color> and sort_items.xml <linearlayout android:layout_width="fill_parent&

apache - htaccess - how to redirect url with params to base url -

i trying redirect page.html params @ end base url without params. know supposed use mod rewrite can't rules figured out. appreciated. here scenario: tried in htaccess , rule didn't work: redirect 301 "/page.html?p=2" http://www.domain.com/page.html i understand reading other posts on stackoverflow should write like ^page\.html$ http://www.domain.com/page.html [qsa,nc,r=301,l] the rules @ end [qsa,nc,r=301,l] incorrect. can't figure out. want 301 url p=2 parameter, , no other param. and process remaining rules after rule other pages. you can put code in root htaccess rewriteengine on rewritecond %{query_string} ^p=2$ [nc] rewriterule ^page\.html$ /page.html? [r=301,l]

list - Android Spinner select Characteristics -

i got annoying problem here , hope can me. i have list of plants (self defined class). these plants got name, id , characteristics. characteristics saved in strings. f.e. characteristic1 size of plant, characteristic2 design of leafs , on.. i have spinners now, , in each of these spinners selection of 1 characteristic should available (spinner1 got characteristics variable characteristics1 plants, ...) goal can use these spinners give user plants, suits user's selection of characteristics. any ideas how can implement in non-spaghetti way? i'm bit new programming need help. i hope explained well, it's quite hard me explaining in second language. my code: plant - class private int pd_id; private string pd_plantname; private string pd_longinfo; private string pd_infochar1; private string pd_infochar2; private string pd_infochar3; private string pd_infochar4; private string pd_infochar5; image-class private int i_id; private int i_p_id; private string i_

php - Laravel / MySql Unique String Based On Id? -

Image
i have following migration create mysql database table public function up() { schema::create('project_auth_keys', function (blueprint $table) { $table->increments('id'); $table->integer('project_id')->unsigned(); $table->string('key', 800); $table->string('first_name', 80); $table->string('last_name', 80); $table->timestamps(); // link project id real project id $table->foreign('project_id')->references('id')->on('projects'); }); } now want ot accomplish make 'key' "unique"... know can changing $table->string('key', 800)->unique(); but don't want make unique whole table want make unique based on project_id. for example entry project_id of 1 , entry project_id of 2 can have same key, there cannot 2 same keys in same project_id. is can within mysql or have make rul

sql server - Action Microsoft.crm.setup.shared.analyzerbase+collectaction failed -

i tried install microsoft dynamics crm 2013 report authoring extension (with sql server data tools support) after installed microsoft sql server data tools - business intelligence visual studio 2012 error came out saying didn´t have requisites, visual studio 2010.... , have 2012... so, downloaded 2015 version , , once tried install it, after updates , downloads setup does, error: action microsoft.crm.setup.shared.analyzerbase+collectaction failed appeared , wouldn't let me go further. i found article not same error: https://support.microsoft.com/en-us/kb/2988630 , lead me delete register files.... not best practice. if find better. i'm running windows 8.1. anyhelp appreciated. ok..... found solution, documented in link : i took chance , deleted specified registry. "expand windows registry tree following registry directory: hkey_local_machine\software\microsoft\windows\currentversion\installer\userdata\s-1-5-18\components\0ef1e6b4efcda2649b26a424

ios - Getting unexpected error cocoapod install pods -

i had pods working fine until tried install pod , started getting strange error, have done no updates , working until recently. podfile platform :ios, '8.0' target 'wireless' pod 'tapjoysdk', '~> 10.2' pod 'mbprogresshud', '~> 0.9.1' pod 'iqdropdowntextfield', pod 'paypal-ios-sdk', pod 'dlradiobutton' end error message getting syntaxerror - /users/amir/desktop/wireless/podfile:10: syntax error, unexpected tstring_beg, expecting keyword_do or '{' or '(' pod 'paypal-ios-sdk', ^ /users/amir/desktop/wireless/podfile:10: syntax error, unexpected ',', ex pecting keyword_end /library/ruby/gems/2.0.0/gems/cocoapods-core-0.36.3/lib/cocoapods-core/podfile.rb:254:in `eval' /library/ruby/gems/2.0.0/gems/cocoapods-core-0.36.3/lib/cocoapods-core/podfile.rb:254:in `block in from_ruby' /library/ruby/gems/2.0.0/gems/cocoapods-core-0.36.3/lib/cocoapods-core/podfile

python - Run production Flask app locally, without a complex web server -

i built small web app friend. friend's computer not connected internet when using app, deploying on heroku not option. is there way deploy locally without having install complex web server? small can packaged application? using built-in flask server seems discouraged when go "production", local app ok? if it's going used offline 1 person, yes, internal development server might sufficient. if you're looking simple way send app her, see pyinstaller : pip install pyinstaller pyinstaller your_app.py zip folder inside new dist directory , pass along. if pyinstaller isn't you, there plenty of options .

c# - How to be dynamically either console application or Windows Application -

i have small application should executed in two modes : non ui or wpf window. should depend on command line arguments. in each mode, need show feedback log: in wpf window mode, wpf going take care of visualizing logs, in no ui mode, need console show logs. if app have been started console (mainly cmd.exe), i'd use without opening new one. if app have been started outside of console (double click on explorer, createprocess, ...), need create new console output results , wait readkey close it. i have found: how can create new console: how open/close console window dynamically wpf application? , how current console windows handle show/hide it: show/hide console window of c# console application and know can statically choose between "windows application" or "console application" in project property. choosing "windows application", getconsolewindow() 0 , don't see how reuse previous console. choosing "console application&quo

using Mean Square Error to create an index matrix matlab -

the mean square error (mse), method used define difference in between 2 blocks, , can calculated follow: a , b 2 blocks equal size mse = sqrt(sum(sum((a-b).^2)))/size(a or b) if mse less given threshold, 2 blocks not diffrent. given 2 matrix a , b , purpose divide 2 matrix blocks of given size, extract first block , let a , search block b b mean square error between a , b less given threshold, return position of block b matrix b . , on. , here example: given 2 matrix a , b where: a= [1 1 4 4 2 2 1 1 4 4 2 2 2 2 9 9 5 5 2 2 9 9 5 5 3 3 4 4 9 9 3 3 4 4 9 9]; b = [ 2 2 4 4 9 9 2 2 4 4 9 9]; the threshold 2 the first block a obtained matrix a is: 1 1 1 1 the block b obtained matrix b msr between a , b less threshold is: 2 2 2 2 therefore return position of block b in matrix b 1 the second block a obtained matrix a is: 4 4 4 4 the block b obtained matrix b msr between a

Passing php variables through pages / sql -

i have following information displayed <?php $my_query="select * games"; $result= mysqli_query($connection, $my_query); if (mysqli_num_rows($result) > 0) while ($myrow = mysqli_fetch_array($result)) { $description = $myrow["game_description"]; $image = $myrow["gamepic"]; $game_id = $myrow["game_id"]; $gamename = $myrow["game_name"]; echo "<div class='cover'> <a href='game_details.php?gameid={$game_id}'> <img src=\"games/$image\" class=\"thumbnail\" width=\"200\" height=\"200\"> </a> </div>"; } ?> as can see have created game_details page display specific game_id when image clicked im having trouble understanding how pull data out game_id in sql on other page. here attempt on game_details page <?php if (!isset($_get['$game_id']) || empty($_get['game_id'])) { echo "invalid

meteor - Multiple CSS style for the same template -

i have make user interface can run in dark or sunny places. so, want make "high contrast" theme , "normal theme". i understood meteor merges , minify css files in 1 big stylesheet. so... wonder how switch between 2 theme, can't use tricks this site explains. i have thought of solution : having super-class on body, contains colors definitions, switch little javascript. seems little rude. any thought of better solution ? if use less (an official meteor package), can define 2 different classes set on body (or main div), , give them different styles: .dark { p { color: #fff; } /* dark styles... */ } .light { p { color: #000; } /* light styles... */ } then indeed, programmatically switch class on <body> or <div> tag, example using template.registerhelper , session class @adnan-y suggested. it cleaner (plus use tons of cool less features lighten , darken ), , compiled css on server run.

android - Video in landscape mode while press fullscreen Button -

Image
i want continue video in landscape mode while press fullscreen button have used textureview , tried videoview , surfaceview only view should landscape not whole activity screenorientation=landscape in manifest this portrait mode what happening right now this code if (!isfullscreen()) { isfullscreen=true; sizeportait[0]=textureview.getwidth(); sizeportait[1]=textureview.getheight(); // framelayout.layoutparams params = new framelayout.layoutparams(layoutparams.match_parent,layoutparams.match_parent); framelayout.layoutparams params = new framelayout.layoutparams(mlayoutvideotrainig.getheight(),mlayoutvideotrainig.getwidth()); textureview.setrotation(90); textureview.setlayoutparams(params); adjustaspectratio(mlayoutvideotrainig.getheight(), mlayoutvideotrainig.getwidth()); } /** * sets textureview transform preserve aspect ratio of video. */ private void adjustaspectratio(int videowidth, int

reporting services - SSRS report with Excel datasource -

i have been able create ssrs report using excel worksheet odbc drivers. however, report not refresh excel worksheet changes daily. preview of data in visual studio shows data day created ssrs report. my connection excel sheet successful. there step prevent ssrs report using cached data , force use current data?

installation - How do I fix 32bit depencies on Ubuntu 14.10 installing pharo? -

i'm having trouble installing pharo on ubuntu 14.10 : following instructions [here][1] : sudo add-apt-repository ppa:pharo/stable sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install pharo-vm-core and last 1 there dependency problem. pharo-vm-core : dépend: pharo-vm-core-i386 and if try install package, got other dependencies problems : pharo-vm-core-i386:i386 : dépend: libasound2:i386 (>= 1.0.16) mais il n'est pas installable dépend: libc6:i386 (>= 2.15) mais il n'est pas installable dépend: libfreetype6:i386 (>= 2.2.1) mais il n'est pas installable dépend: libgl1-mesa-glx:i386 mais ne sera pas installé ou libgl1:i386 dépend: libssl1.0.0:i386 (>= 1.0.0) mais il n'est pas installable dépend: libx11-6:i386 mais il n'est pas installable i'm kind of stuck now... [1

postgresql - How to change JSON text of MySql database to JSON datatype of postgres sql -

how change json text of mysql database json datatype of postgres sql.i storing json data in database table of mysql , want convert json datatype of postgres sql mysql create table create table if not exists `employee` ( `id` bigint(40) not null auto_increment, `employee_id` bigint(40) not null, `employee_info` text not null, ) in employee_info storing {"employee_name":"abc","address":"1","emloyee_weight":"30","age":"100","phone":"9845236775"} in mysql database json . and wanted convert json datatype of postgressql question shouldn't left unanswered :-) it's pretty simple: postgresql create table create table employee ( id bigserial primary key, employee_id bigint not null, employee_info json not null ); and can magic like: select * employee employee_info->>'address' '%kr%'; or select * employee cast(employee

arrays - PHP JSON trying to get property of non-object error when looping -

i error notice: trying property of non-object each time array @ index 0. but works if there more 1 value in array. $jsonurl = "https://example.org/json_response/"; $json = file_get_contents($jsonurl,0,null,null); $json_output = json_decode($json, true); foreach ( $json_output $output ) { echo $output->id; } using var_dump($json_output); returns data. edited array (size=2) 'id' => string 'xyue78ee9es' (length=10) 'username' => string 'peesbee' (length=7) but throws error when try accessing variable echo $output->id;. as have said in comments above, once you've set json_decode flag true , in turn, you'll array instead of object. following in comments: can show me $json_output array ? – prakash @prakash, array (size=1) 'id' => string 'xyue78ee9es' (length=10) – user123451 it seems normal flat array, treat such. actually, wouldn't need foreach anymore. c

ldap - Active Directory Replicated Attributes Replication System Flags -

in active directory schema, attribute entries have "system-flags" attribute indicates options attributes including replication across domain controllers. from remarks section @ https://msdn.microsoft.com/en-us/library/ms680022%28v=vs.85%29.aspx found out that system-flags bit 1 indicates attribute not replicated. system-flags bit 2 indicates attribute replicated "global catalog" i programmer uses ad service provided infrastructure team. don't know "global catalog" is, looking non-replicated attributes can query domain controllers them find value need. i ran bitwise query find non-replicated attributes have bit 1 on in system-flags. got list of attributes. (&(objectcategory=attributeschema)(systemflags:1.2.840.113556.1.4.803:=1)) i wanted test consistency of querying attributes both replicated , not checking attributes bits 1 , 2 both on. (&(objectcategory=attributeschema)(&(systemflags:1.2.840.113556.1.4.803:=1)(system

c++ - How to change dll location to subdirectory in Codelite? -

im using codelite ide , build test.exe gui application. when started application got error dlls missing. found dll , put in folder test.exe, , working now. dlls there mess in main folder. how move dlls sub directory application still work, except add folder in path? you need change path environment variable make work in codelite, add line similar from: settings->environment variables path=$path;c:\path\to\my\dll\folder ofc, replace c:\path\to\my\dll\folder actual path want dlls placed eran

python - Query by snimpy's Session takes too much time -

i use snimpy library query oid . this query execution time takes ~15sec 's: from snimpy.snmp import session s = session(host, "83l80n3") oid, host_cpu = s.get((1, 3, 6, 1, 4, 1, 9, 9, 109, 1, 1, 1, 1, 5, 1))[0] but system snmpget executes immediately. question did missed something? set "localhost" explicitly. s = session("localhost", "83l80n3")

BigQuery bq command with asterisk (*) doesn't work in Compute Engine -

i have directory file named file1.txt and run command: bq query "select * [publicdata:samples.shakespeare] limit 5" in local machine works fine in compute engine receive error: waiting on bqjob_r2aaecf624e10b8c5_0000014d0537316e_1 ... (0s) current status: done bigquery error in query operation: error processing job 'my-project-id:bqjob_r2aaecf624e10b8c5_0000014d0537316e_1': field 'file1.txt' not found. if directory empty works fine. i'm guessing asterisk expanding file(s) query don't know why. apparently bq command located @ /usr/bin/bq has following script: #!/bin/sh exec /usr/lib/google-cloud-sdk/bin/bq ${@} which expands asterisk. as current workaround i'm calling /usr/lib/google-cloud-sdk/bin/bq directly.

Unpivot and Pivot does not return data -

i'm trying return data columns. i've written unpivot , pivot query: `select stockitemcode, barcode, barcode2 (select stockitemcode, col+cast(seq varchar(20)) col, value ( select (select min(stockitemcode) rtlbarcode t2 t.stockitemcode = t2.stockitemcode) stockitemcode, cast(barcode varchar(20)) barcode, row_number() over(partition stockitemcode order stockitemcode) seq rtlbarcode t) d unpivot( value col in (barcode) ) unpiv) src pivot ( max(value) col in (barcode, barcode2)) piv;` but problem "barcode2" field returning value (the barcode field returns null when in fact there value. sample data i have table called rtlbarcode has field called barcode , field called stockitemcode for stockitemcode = 10 have 2 rows barcode value of 5014721112824 , 0000000019149. can see going wrong? many thanks you indexing barcode in unpiv. results in col 's-values barcode1 , barcode2 . but pivoting on barcode instead of barc

jquery - Get data from JSON array within JSON array -

i'm trying data json array within json array, having little success. so our server returns json array within variable called 'msg', when console.log it [{"product":"[{\"imgurl\":\"/p/332401\",\"prodcartqty\":2,\"prodname\":\"test product 1",\"productcode\":\"332401\"},{\"imgurl\":\"/p/332388\",\"prodcartqty\":2,\"prodname\":\"test product 2",\"productcode\":\"332388\"}]","category":"gross_max_1","totalcategory":1},{"product":"[{\"imgurl\":\"/p/332401\",\"prodcartqty\":2,\"prodname\":\"test product 1",\"productcode\":\"332401\"},{\"imgurl\":\"/p/332388\",\"prodcartqty\":2,\"prodname\":\"test product 2",\"productcode\":\"332388\"

Eclipse java dead code warning not working properly -

i using eclipse luna 4.4 think not showing me warning dead code. it shows error if(false){ // shows warning dead code here system.out.println("dead code"); } but doesn't show warning if say boolean b = false; if(b){ // doesn't show warning dead code here system.out.println("dead code"); } somehow have little memory giving warning on previous version don't know which. once doing like boolean b = false; // code here // forgot make true in case if(b){// things here} // gave me warning. do know happend here or there setting in preferences can this. thank in advance.

"context.setDocumentMode" fails in Xpage Extension Library toolbar -

i try put document in edit mode using toolbar extension library. below source toolbar. when clicked page refreshes mode not change. have added regular button same code in on-click event , works there. <xe:toolbar id="toolbar2" style="font-family:arial,sans-serif;font-size:12pt;font-weight:bold"> <xe:this.treenodes><xe:basiccontainernode label="article actions"> <xe:this.children> <xe:basicleafnode label="edit article" submitvalue="edit" rendered="# {javascript:!document1.iseditable();}"> </xe:basicleafnode></xe:this.children></xe:basiccontainernode> </xe:this.treenodes><xp:eventhandler event="onitemclick" submit="true" refreshmode="complete"><xe:this.action><![cdata[#{javascript:var achoice = context.getsubmittedvalue(); switch(achoice){case "edit": context.setdocumentmode("document1","edit"

node.js - Strange behaviour coding with events -

so working on application quite bit of database work, , thought 1 smart way of getting around should use events. set events emitter application use, , using way control flow. , kind of assumed events emitter work similar message queue or similar. this not case, , reason can not emitter work expected on second call same function. i have understood if problem called multiple times, is, below code run second function twice, passed dbevents.once('ready' once. , not can not figure out why, seems work constantly, , never print out "wrote fourth" var mongo = require('mongodb'); var events = require('events'); var dbevents = new events.eventemitter(); function writestuff(first, second, status, cuid){ console.log('wrote '+ first); if (status === 1) { console.log('\t\tready '+ cuid); dbevents.emit('ready'); } else { console.log('\t\tready (but not 1) ' + cu

c# - Inheriting from an interface with properties of the same name -

i have interface iproduct , 2 partial classes searchedproductinternal , searchedproductexternal. these 2 classes extending classes coming 3rd party webservice searches both return different result types. want use interface both type returned same. know how inherit do return "name" both interface , searchedproductinternal have same object name? my interface similar follows: public interface iproduct { string name { get; } string id { get; } string descriptionshort { get; } string descriptionlong { get; } } my object searchedproductinternal has following properties: string name; int objectidfield; string descriptionshortfield; string descriptionlongfield; so inheriting public partial class searchedproductinternal : iproduct { public string id { { return objectidfield.tostring(); } } public stri

Unable to load map on android emulator -

Image
i android app have google map apiv2 , able display map on physical device when try on emulator shows message - this app won't run unless update goolge play service. i have updated google play service upto api level 19 , set android:targetsdkversion="19" in manifest file. and created avd google apis target , api level 19.bus still receive same message while opening map activity. can please me. thanks in advance!! at moment, referencing google android map api v2 can't run google maps v2 on android emulator; must use device tests. i recommend using emulator genymotion instead of google's emulators. launches way faster , responds in real-time. supports google play services , therefore google maps. download genymotion

dictionary - Java data structure to allow boolean flags on objects and sorting? -

i wish have set of objects , booleans mark object "visited" or not. naturally thought of map tell me if object visited or not. want them sorted too, whenever ask "who 'smallest' object visited?". calculation wouldn't difficult, max o(n) on data structure. in specific case i'm asking date object, it's irrelevant. objects can added data structure @ moment, , entered 'false' values. use sortedset . when object visited, add set. find out if object visited, use set.contains() . find smallest object: t smallest = set.isempty() ? null : set.iterator().next();

sql server - Dynamicaly build search query in MS SQL -

i have table tbllocation stores data in following way locationid |propertyname |propertyvalue ------------------------------------------------ 1 |type |city 1 |name |los angeles 1 |state |california 1 |populationdensity |8092 2 |type |city 2 |name |houstan 2 |state |texas 2 |populationdensity |3501 the front end application sent search criteria in following format stored procedure. {{@@state!!<equals>##california??}[or]{@@state!!<equals>##texas??}}[and]{@@populationdensity!!<greater than>##3000??} currently above string parsed , dynamic sql statement created in stored procedure. is there better way without using dynamic sql? cannot change input format stored procedure.

c++ - Why can templates only be implemented in the header file? -

quote the c++ standard library: tutorial , handbook : the portable way of using templates @ moment implement them in header files using inline functions. why this? (clarification: header files not only portable solution. convenient portable solution.) it not necessary put implementation in header file, see alternative solution @ end of answer. anyway, reason code failing that, when instantiating template, compiler creates new class given template argument. example: template<typename t> struct foo { t bar; void dosomething(t param) {/* stuff using t */} }; // somewhere in .cpp foo<int> f; when reading line, compiler create new class (let's call fooint ), equivalent following: struct fooint { int bar; void dosomething(int param) {/* stuff using int */} } consequently, compiler needs have access implementation of methods, instantiate them template argument (in case int ). if these implementations not in header, wouldn

repository - error while running apt-get update probably incorrect release file causing apt-get update to fail -

i've been using elementary os 0.3 freya (64-bit) built on ubuntu 14.04 when tried open software updater showing failed download repository information , when tried run sudo apt-get update this prints: w: failed fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty/release unable find expected entry 'restricted/source/sources' in release file (wrong sources.list entry or malformed file) e: index files failed download. have been ignored, or old ones used instead. i donno whats problem , cann't find solution while googled it. from i've read on issue, 1 of repositories has failed. maybe try removing them 1 @ time , see if can find offending one. edit ppa's , change freya trusty. not sure if ideal solution, fixes it.

javascript - Wordpress: Theme original menu not hiding on mobile view -

i using wordpress responsive menu-plugin. when in mobile view 2 menus - plugin menu , theme's original menu. working on local cant give web address. find wrapping div of main menu , write media query hide in mobile sizes. @media(max-width:768px){ .wrapping-class{ display: none; } }

mysql - Reload vagrant after an update -

what fastest method reload vagrant after changing provisioning script ? i copying file "mysql.sql" guest machine, in "vagrant": config.vm.provision "file", source: "mysql.sql", destination: "mysql.sql" and call "bootstrap.sh": mysql -h localhost -u root -proot < /home/vagrant/mysql.sql i used use: vagrant destroy vagrant vagrant provision vagrant ssh i tried see if: vagrant reload will same thing, not sure this, since modifications happens on .sql file , not in vagrant file. you can run vagrant reload --provision run provisioner . provision on first vagrant up creates environment, provisioning run. if environment created , resuming machine or booting up, won't run unless --provision flag explicitly provided. when vagrant provision used on running environment. when vagrant reload --provision called. --provision flag must present force provisioning. p.s. bug fix in

r - Poisson regression on gravity model -

Image
for university project, trying fit regression model demand number of independent variables. tried include small example, didn't work figure (as new this). instead, see following link view sample of dataset using: in table, first column indicates country pairs, columns 2 6 independent variables, , final column depedent variable. do, perform regression analysis, assuming data can described gravity equation. i know people use log-linearisation solve this. however, dealing zeros in data (and don't distort data adding small constants), , assume heteroskedasticity in data, use different method. based on santos 2006 described (in paper "the log of gravity"), use poisson pseudo maximum likelihood estimation. however, new using r (or statistical software), , cant figure out how in r. can me this? thing i've found far glm commands poisson , quasipoisson used ( https://stat.ethz.ch/pipermail/r-help/2010-september/252476.html ). i've searched in documents on

java - How to limit a Hadoop MapReduce job to a certain number of nodes? -

so, have system 4 data nodes. however, check scalability of hadoop application, want test 1, 2 , 4 nodes. so, how can limit number of nodes used hadoop 1 or 2. using hadoop 2.5.1 , don't have admin rights system. moreover, how can control number of cores used hadoop node? you need admin rights that how can limit number of nodes used hadoop 1 or 2. decommission 2-3 nodes how can control number of cores used hadoop node set below config in yarn-site.xml allocate 8 vcores per node <property> <name>yarn.nodemanager.resource.cpu-vcores</name> <value>8</value> </property> also update yarn.scheduler.capacity.resource-calculator in capacity-scheduler.xml because defaultresourcecalculator uses memory. <property> <name>yarn.scheduler.capacity.resource-calculator</name> <value>org.apache.hadoop.yarn.util.resource.dominantresourcecalculator</value> <description> resou

vb.net zip overwrite files in zipped directory -

i got code zip files in directory. here is private sub zipfiles() dim zippath string = "c:\temp\compression\myzip.zip" 'open zip file if exists, else create new 1 dim zip package = zippackage.open(zippath, _ io.filemode.openorcreate, io.fileaccess.readwrite) 'add many files like: addtoarchive(zip, "c:\temp\compression\compress me1.txt") addtoarchive(zip, "c:\temp\compression\compress me2.txt") addtoarchive(zip, "c:\temp\compression\compress me3.txt") zip.close() 'close zip file end sub private sub addtoarchive(byval zip package, _ byval filetoadd string) 'replace spaces underscore (_) dim urifilename string = filetoadd.replace(" ", "_") 'a uri starts forward slash "/" dim zipuri string = string.concat("/", _

Tsql table variable to Oracle PLSql -

i working on tsql plsql conversion. there several table variables declared , used in tsql, like declare @table_var table( id_ int ......) while ... begin insert @table_var select ... ... select * @table_var.. i think in oracle global temporary table can used, data maximum 10k rows. how efficient global temporary tables in case? there other way other global temporary table , table types in oracle convert similar sql query? oracle version: oracle11g or oracle12c depending on size of data , task want achieve-- can use pl/sql record/table , bulk processing hold data in cursor , loop through if want kind of query update -- can use in-line view (preserving primary key)

java - Should action listeners be in the class they apply to? -

i'm programming web browser multiple classes. 1 class "navbar" holds of buttons such search, back, forward, etc. navbar class has action listeners which, when search button pressed, become active, , lead production of url, needs passed jeditorpane, editor pane in different class, "editor". it not make sense editor instantiated inside navbar, how can pass variable navbar class editor class? is okay use statics in situation? why not give nav bar reference editor? done in constructor, if editor instantiated first, or via getter/setter pair (actually, setter needed...). if nav bar has such reference, can call appropriate methods within listener implementation. class editor { ... } class navbar implements actionlistener { public navbar(editor editor) { myeditor = editor; } public void actionperformed (actionevent e) { // call methods of myeditor } private editor myeditor; } editor theeditor = new edit

python 3.x - code not continuing to loop -

i need write function has22(nums) takes list of ints nums , returns true if list contains 2 next 2 somewhere. my approach: def has22(nums): in range(len(nums)-1): if nums[i] == 2 , nums[i+1] == 2: return true else: return false print(has22([1, 2, 2])) **should** evaluate to: true #got: false print(has22([1, 2, 21, 2])) evaluates to: false print(has22([2, 1, 2])) evaluates to: false print(has22([2, 2])) evaluates to: true print(has22([4, 3, 2, 1])) evaluates to: false what need function continues looping? the problem return false after first pair! instead, should return false after have scanned entire list. def has22(nums): in range(len(nums)-1): if nums[i] == 2 , nums[i+1] == 2: return true return false alternatively, use zip(nums, nums[1:]) generate pairs of consecutive numbers: def has22(nums): return (2, 2) in zip(nums, nums[1:])

Calculate Row Percentage Bash One line Command -

i need know how calculate row percentages using 1 line bash command. suppose content of file test.tsv looks this: item sort clicks clicks b item 1 100 50 item 2 60 40 i want know percentage each click sort item like: item sort clicks clicks b item 1 66.70% 33.33% item 2 60% 40% any ideas on how this? use awk kind of thing, bash doesn't real/floating-point arithmetic. awk script: nr==1 { print } nr>1 { printf("%s %d %.2f%% %.2f%%\n" , $1, $2 , ($3*100/($3+$4)) , ($4*100/($3+$4)) ) } which means: if line number 1, print as-is. for other lines, print columns 1 , 2 as-is, calculate respective percentage columns 3 , 4. in 1 line: awk 'nr==1{print}nr>1{printf("%s %d %.2f%% %.2f%%\n", $1, $2, ($3*100/($3+$4)), ($4*100/($3+$4)))}' test.tsv

Android forever in background -

i write application android. app should write file every change on battery percentage, voltage, remaining ram, current date , time, etc. app in background , when switch out app, os kill application. issue. somewhere have read possibility broadcastreciever , have 1 set react on battery change, doesn't solves problem. ideas? you need use foreground service, os not kill it, see running service in foreground

ios - Custom NSError codes -

i building cocoa touch framework uses custom nserror object communicated errors caller. need declare enum defines custom error codes. went apple doc lists nsurlerrordomain error codes shown below: enum { nsurlerrorunknown = -1, nsurlerrorcancelled = -999, nsurlerrorbadurl = -1000, nsurlerrortimedout = -1001, nsurlerrorunsupportedurl = -1002, nsurlerrorunsupportedurl = -1002, nsurlerrorcannotconnecttohost = -1004, nsurlerrordatalengthexceedsmaximum = -1103, nsurlerrornetworkconnectionlost = -1005, nsurlerrordnslookupfailed = -1006, nsurlerrorhttptoomanyredirects = -1007, nsurlerrorresourceunavailable = -1008, nsurlerrornotconnectedtointernet = -1009, nsurlerrorredirecttononexistentlocation = -1010, nsurlerrorbadserverresponse = -1011, nsurlerrorusercancelledauthentication = -1012, nsurlerroruserauthenticationrequired = -1013, nsurlerrorzerobyteresource = -1014, nsurlerr

c# - Regular expression with a limited length, spaces and other limitations -

i'm looking following regex: the match can empty. if not empty, must contain @ least 2 characters english letters or digits. the regex must allow spaces between words. this come with: ^[a-za-z0-9]{2,}$ it works fine, not except spaces between words. here, can use regex make sure match kind of spaces (even hard space), , make sure allow empty string match: (?i)^(?:[a-z0-9]{2}[a-z0-9\p{zs}]*|)$ c#: var rg11x = new regex(@"(?i)^(?:[a-z0-9]{2}[a-z0-9\p{zs}]*|)$"); var tst = rg11x.ismatch(""); // true var tst1 = rg11x.match("mc donalds").value; // mc donalds

android - How to create animation dynamically and add it to overridePendingTransition -

i want know how add animations created dynamically in java overridependingtransition. i created custom animation in java. animation anim = new scaleanimation(....); now want add animation overridependingtransition. overridependingtransition(anim, anim); but error. says need have int. know can use r.anim.scaleanim created xml too. want create animation dynamically in java pivotx , pivoty values changed in code. please me. thank you!

c - Creating premake project for PuTTYTray -

i'm trying use premake 4 create vs2013 project files puttytray . initially i'm trying build putty.exe i'd able build original suite, based on original project files. solution "puttytray" configurations {"debug", "release"} project "putty" kind "consoleapp" language "c++" files { "*.h", "*.c", "windows/**.c", "windows/**.h" } excludes { "pscp.c", "be_all.c", "psftp.c", "be_all_u.c", "be_none.c", "be_nos*", "be_ssh.c", "nocproxy.c", "puttytel*", "notiming.c", "noterm.c", "noprint.c", "noshare.