Posts

Showing posts from September, 2010

php - How to quickly find elements in a sorted array -

i new here have checked previous posts , although similiar, not quite enough i'm trying do. have csv file 40k+ records , retrieve ldap records of 70k+ records; both stored in multidimensional array variable. objective display records not match. current solution taking on 20 minutes process inefficient. created outer loop each record checks match in ldap recordset (inner loop), if found skip next record , unset ldap array index shrink array next loop. have sorted both arrays in ascending order speed process. ideas, tweaks, speed process? foreach($csvarray $csvindex=>$csvalue) { echo "<br />csvarray record: <strong> ".$counter."</strong><br />\n"; if($counter <= 1) { ($i = 0, $max=$rs["count"]-1; $i < $max ;$i++) { //loop through ldap array if($csvalue[0] == $rs[$i]['uid'][0]) { // csv netid & ldap netid echo "csv netid: ".$csvalue[0]; e

c# - How do I nest async statements were the execution of the nested statement is dependant on the result of the first? -

i'm trying build asynchronous method read record or create if no matches found. i using async api provided sqlite.net. this far have got think i'm struggling concepts, existingopponent null insert executed. public async task<testentity> createorget(string name, cancellationtoken cancellationtoken = default(cancellationtoken)) { var existingentity = await database.getconnection(cancellationtoken) .table<testentity>() .where(o => o.name == name) .firstordefaultasync(); if (existingentity == null) { var newentity = new testentity() { name = name }; var rowcount = await database.getconnection(cancellationtoken) .insertasync(newentity); return newentity; } return existingentity; } is able point me in right direction? was query problem rather async problem.

different RA/Decs returned by pyEphem -

i using pyephem calculate ra/decs of satellites , i'm confused different values computed , described on http://rhodesmill.org/pyephem/radec.html this bit of code sat=ephem.readtle("satname ", \ "1 38356u 12030a 14148.90924578 .00000000 00000-0 10000-3 0 5678",\ "2 38356 0.0481 47.9760 0002933 358.9451 332.7970 1.00270012 3866") gatech = ephem.observer() gatech.lon, gatech.lat = '-155.47322222', '19.82561111' gatech.elevation = 4194 gatech.date = '2014/01/02 07:05:52' sat.compute(gatech) print 'a_ra=',sat.a_ra,'a_dec=',sat.a_dec,'g_ra=',sat.g_ra,'g_dec=',sat.g_dec,'ra=',sat.ra,'dec=',sat.dec gives a_ra= 0:52:40.75 a_dec= -3:15:23.7 g_ra= 1:14:10.55 g_dec= 0:06:09.8 ra= 0:53:23.57 dec= -3:10:50.5 if change observers location gatech.lon, gatech.lat = '-5.47322222', '19.82561111' i get a_ra= 1:15:36.95 a_dec= -2

Java String Translation -

is possible translate string other language in java? example, if have code: class example { public static void main(string[] args) { string s = "text"; system.out.println(s); } } can translate s other language in code (for example someclass.translatetosomelanguage(s) )? the place supported in jdk simpledateformat formatting dates providing locale . you'll need external library else.

c - Binary Search Tree Madness -

i have write implementation of binary search tree can handle library's stock. reads text file books , add books tree in alphabetic order. have been fighting insertar() function code days , can't make work properly, receives pointer root of tree along data related book. if root null, inits node values entered in function , asings memory direction null node. problem is, doing locally , in end doesnt assigns it. can me correct specific function please? functions , structs: nodoarbol: node arbolbin: binary tree, has pointer root node , int number of elements initnodo: inits node, returns pointer node raiz: returns pointer root of binary tree clear,clear_aux: clears tree ingresar: insert() function , source of problem imprimir: rints elements of node. #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct nodoarbol { char nombre[51],autor[51]; int valor,stock,anno; struct nodoarbol *der; struct nodoarbol *izq; } tnodoa

php - How to query and select * where a value is a INT? -

this sql far , nothing working. $st = db::getinstance()->query("select * users group = 1 order joined asc"); all want select * table users group = 1 (order by...) problem group column int. cannn't retrieve data it. if try group = '1' is there function/way through issue? thanks! group reserved word in many sql implementation. try using users.group = 1 . oracle sql reserved words : https://docs.oracle.com/database/121/sqlrf/ap_keywd001.htm#sqlrf55621 mysql reserved words : http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html mssql reserved words : http://msdn.microsoft.com/en-us/library/ms189822.aspx

class - How does return by reference work in C++ classes? -

in c++ , if type: int x=5; int &y=x; then y act alias memory location original x stored , can proven/tested printing memory location of both, x , y the output of similar program below: x @ location: 0x23fe14 y @ location: 0x23fe14 but classes ? when member function declared return type reference , function uses this pointer, function returning? for example: #include <iostream> class simple { int data; public: // ctor simple(): data(0) {} // getter function int& getter_data() { return this->data; } // modifier functions simple& add(int x=5) { this->data += x; return *this; } simple& sub(int x=5) { this->data -= x; return *this; } }; int main() { simple obj; obj.add().sub(4); ////////// how & why working? ///////// std::cout<<obj.getter_data(); getchar(); } why possible execute command in highlighted line? wha

arrays - How to resolve Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2? -

can me solving type of error exception in thread "main" java.lang.arrayindexoutofboundsexception: 2 i searching data in linked list when want insert data array, turn this: matric | nama | sem | cc | ch | fm 32255 | izzat | 1 | ccs2 | 3 | 45.0 | | 2 | ccs3 | 3 | 56.0 32345 | khai] | 3 | ccs4 | 3 | 45.0 | | 2 | ccs5 | 3 | 2.0 32246 | fifi | 1 | cc1 | 3 | 60.0 | | 1 | ccs3 | 4 | 34.0 34567 | dudu | 2 | ccs2 | 2 | 24.0 | | 2 | ccs4 | 6 | 79.0 first-->34567-->32246-->32345-->32255-->null first-->6-->2-->4-->3-->3-->3-->3-->3-->null first-->2-->2-->1-->1-->2-->3-->2-->1-->null first-->dudu-->fifi-->khai]-->izzat-->null first-->ccs4-->ccs2-->ccs3-->cc1-->ccs5-->ccs4-->ccs3-->ccs2-->null first-->79.0-->24.0-->34.0-->60.0-->2.0-->45.0-->56.0-->45.0-->null 42insert

javascript - Identify width of div from previous page -

i creating website set layout, yet 1 element expands width specific page through .animate() . this works statically, if know page came. yet, if order changes width of elements not correspond more. what need way identify page came set width of div on current page width of div on previous page. change width needed in order create smooth transition. this within same website, yet different html documents per page. example $(document).ready(function(){ var widthdivprev = width div page user came $("#currentdiv").css({ "width": "widthdivprev", }); $( "#currentdiv" ).animate({ width:"800px", }, 1500 ); }); this piece of code can't figure out var widthdivprev = [get width div page user came] or maybe even var idpage = [pagefrom user came] even if can last can use if function width css save width of current page in sessionstorage if (se

android - selectableItemBackground crashing App -

i'm trying make imagebutton using android:background="?attr/selectableitembackground" app crashed. following answer , question . idea? thanks help. activity.xml <imagebutton android:id="@+id/signup" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/signin" android:layout_alignparentbottom="true" android:layout_marginbottom="80dp" android:background="?attr/selectableitembackground" android:src="@drawable/sign_up" android:contentdescription="@string/button_sign_up" /> log cat 05-31 18:50:24.077: w/dalvikvm(28619): threadid=1: thread exiting uncaught exception (group=0x41d0b2a0) 05-31 18:50:24.082: e/androidruntime(28619): fatal exception: main 05-31 18:50:24.082: e/androidruntime(28619): java.lang.runtimeexception: unable start activity componentinfo{

How to shift 2d array elements down in C -

i trying shift contents of 2d array down when implementing tetris in c. move blocks down. code works not moving elements once only, see image problem(the number in top left corner random number determines block type). appreciated. below array shifting code: //declare size of board int board [22][10] = {}; //shift down for(i=2;i<20;i++) { for(z=1;z<10;z++) { board[i+1][z] = board[i][z]; } } http://i61.tinypic.com/xlb58g.jpg whenever shift contents of array, must work in opposite direction shifting. in case, need invert direction of outer loop: int board [22][10] = {}; for(i = 20; i-- > 2; ) { for(z=1; z<9; z++) { board[i+1][z] = board[i][z]; } } this allows row of unused values rise in array bubble. edit: code above written match apparent intended behavior of code posted in question. if entire array moved, use code: for(i = sizeof(board)/sizeof(*board) - 1; i--; ) { for(z =

parsing - Anchors in Yaml -

i'm learning yaml , have problem code: http://hastebin.com/focokeqawo.sm --- classes: audio: - &music components.audio.music - &sound components.audio.sound graphic: - &animation components.graphic.animation - &image components.graphic.image - &text components.graphic.text misc: - &camera components.misc.camera - &debug components.misc.debug collider: - &circle components.physics.circle - &hitbox components.physics.hitbox - &polygon components.physics.polygon common: - &physics components.physics - &transform components.transform &wabbit wabbit: name: wabbit components: - type: *transform x: 150 y: 120 - type: *image file: wabbit - type: *physics - type: *debug &coin coin: name: coin components: - type: *transform x: 370 y: 180 scalex: 5 scaley: 5 - ty

node.js - Is it possible to access a localhost from a vagrant devbox? -

i'm running application on local vagrant vm on computer , wondering if created node server ran on localhost (also on computer) able access node server vagrant application ? with default vagrant settings, can reach host computer via ip 10.0.2.2 . @ least true virtualbox provider. haven't tested others far. if have configured node server on host machine in way listens all ip addresses assigned host computer should able access http://10.0.2.2 from within vagrant virtual machine.

matlab - Need help in using bsxfun -

i have 2 arrays in matlab: a; % size(a) = [nx ny nz 3 3] b; % size(b) = [nx ny nz 3 1] in fact, in 3 dimensional domain, have 2 arrays defined each (i, j, k) obtained above-mentioned arrays a , b , respectively , sizes [3 3] , [3 1] , respectively. let's sake of example, call these arrays m , n . m; % size(m) = [3 3] n; % size(n) = [3 1] how can solve m\n each point of domain in vectorize fashion ? used bsxfun not successful. solution = bsxfun( @(a,b) a\b, a, b ); i think problem expansion of singleton elements , don't know how fix it. i tried solutions, seems loop acutally fastest possibility in case. a naive approach looks this: %iterate c=zeros(size(b)); a=1:size(a,1) b=1:size(a,2) c=1:size(a,3) c(a,b,c,:)=squeeze(a(a,b,c,:,:))\squeeze(b(a,b,c,:)); end end end the squeeze expensive in computation time, because needs advanced indexing. swapping dimensions instead faster. a=permute(a,[4,5,1,2,3]); b=per

.htaccess - htaccess rewriterule with order in url -

i'm trying put rewrite rule apache server. should take 'order/###' , change 'order.php?id=###'. reason it's rewriting 'order.php/###'. if change other 'order' rule works fine. anyone know what's going on? my .htaccess file looks this: rewriteengine on ## tighten host rewritecond %{http_host} !^mydomain\.com$ [nc] rewriterule .? http://mydomain.com%{request_uri} [r=301,l] ## dynamic pages rewriterule ^order/([0-9]+)/?$ order.php?code=$1 [l,nc] ## static page redirects rewriterule ^prices$ /prices.php [l,nc] rewriterule ^examples$ /examples.php [l,nc] i have no access httpd main server config file on live server. i'm using wamp server local development.

ios - How do I set up relationship for large core data sets efficiently? -

i have 2 entities drink , breweries. have data in json , building out core data tables each , have relationship set (one 1 drink brewery). however, trying set @ time of building out drink objects slows down process because having query core data every time create new drink (there couple thousand drinks , 1000 breweries). @ moment brewery has unique id matches attribute on drink. best way go without slowing down load time greatly? considering using 1 entity instead , placing breweries in same table though bad db practice. here code building out drink table json code adding in brewery commented out. [jsoncategories enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop){ drink *drink = [nsentitydescription insertnewobjectforentityforname:@"drink" inmanagedobjectcontext:importcontext]; //drinktype.id = [obj objectforkey:@"id"]; drink.name = [obj objectforkey:@"name"]; drink.alcoholbyvolume = [obj objectforkey:@"abv"]

Where to put txt file when running iOS simulator -

i building simple ios app. , need read data text file. don't know put it. i have tried put under debug-iphoneos or debug-iphonesimulator. doesn't work. drag project. when asked if should part of app target, make sure is. result when build app, file copied app bundle , make way onto target device part of app, code can retrieve it, along these lines: nsstring* f = [[nsbundle mainbundle] pathforresource:@"myfile" oftype:@"txt"]; nserror* err = nil; nsstring* s = [nsstring stringwithcontentsoffile:f encoding:nsutf8stringencoding error:&err];

Java Validation - Adding @Valid constraint to custom constraint throws "@Valid is not applicable to annotation type" -

i have model object annotated java validation annotations. class criteria{ @notempty string id; @notempty string name; string filename; string hours; } as per business requirement, either filename or hours field populated, validate have custom validator 'criteriavalidator' written. @documented @constraint(validatedby = {criteriavalidator.class}) @retention(retentionpolicy.runtime) @target({elementtype.type , elementtype.field, elementtype.parameter}) public @interface validcriteria { string message() default "{criteria.invalid}"; class<?>[] groups() default {}; class<? extends payload>[] payload() default {}; } the model above passed in input parameter method annotated @valid , @validcriteria. public void update(@valid @validcriteria criteria criteria){...} the issue have 2 annotations in method. have add @valid in order check constraints annotated within class. custom validator checks existence of 1 of 2

python - how does QueryDict split HttpRequest query -

example: >>> django.http import querydict >>> q = querydict('a=x&b=y&c=z') >>> q <querydict: {u'a': [u'x'], u'c': [u'z'], u'b': [u'y']}> >>> q = querydict('a=x&b=y&c=z+1') >>> q <querydict: {u'a': [u'x'], u'c': [u'z 1'], u'b': [u'y']}> >>> ^ why '+' replaced space? + reserved shorthand notation space. to represent + , use %2b : >>> querydict('a=x&b=y&c=z%2b1') <querydict: {u'a': [u'x'], u'c': [u'z+1'], u'b': [u'y']}>

setting number to a clicked item of android gridview -

i new android programming. question might easy not soln. want set empty gridview , set number starting 1 , increasing when clicked @ item of gridview. can set gridview not set number clicked item. can help? thanks... here code; public class mainactivity extends activity { gridview grid; string[] numbers = new string[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); grid = (gridview) findviewbyid(r.id.gridview); arrayadapter adapter = new arrayadapter(this, android.r.layout.simple_list_item_1,numbers); grid.setadapter(adapter); grid.setonitemclicklistener(new onitemclicklistener() { @override public

perl - Finding number of insertions,deletions, and changes between two files unix -

assuming have 2 text files first- apple orange pineapple banana watermelon the second- apple grape orange juice pineapple watermelon so see grape has been added, banana has been removed, , orange has been changed orange juice. main result want 1 change has occurred because orange has been changed orange juice. any appreciated. just use diff command. $ diff f1 f2 2c2,3 < orange --- > grape > orange juice 4d4 < banana

c# - Implicit interface based on class -

Image
i have lot of classes in business layer have interface must have same methods , properties public methods , properties of business class. common scenario, interface needed dependency injection , mocking while unit testing. it optimal if somehow define interface same public methods , properties of class. way don't have copy paste method definitions implemented class interface time. don't see logical problem this, know it's not directly possible in c#. perhaps can come reasonable way accomplish this? here example. here interface. public interface iaccountbusiness { guid getaccountidbydomain(string domain); void createaccount(string accounttype, string accountname); } here implementation: public class accountbusiness : iaccountbusiness { public guid getaccountidbydomain(string domain) { // implementation } public void createaccount(string accounttype, string accountname) { // implementation } } if want add pa

ios7 - EXC_BAD_ACCESS (SIGSEGV) and KERN_INVALID_ADDRESS -

this issue getting on nerves. please see crash report , help. in ios 6 app working fine. performing operations. after 30 operations completed experiencing crash. number can go till 20 or 1 also. attaching crash log this. experts please help. incident identifier: e863e717-de21-4bd0-a203-32e9d4648869 crashreporter key: b7fe8726c57b6cc93687be0e904625ecf3813fb9 hardware model: ipad2,5 process: mobile [3833] path: identifier: version: code type: arm (native) parent process: launchd [1] date/time: 2014-06-01 17:07:33.679 +0530 os version: ios 7.0.6 (11b651) report version: 104 exception type: exc_bad_access (sigsegv) exception subtype: kern_invalid_address @ 0x1e2d1f28 triggered thread: 0 thread 0 crashed: 0 libobjc.a.dylib 0x38e79b26 objc_msgsend + 6 1 corefoundation 0x2e618650 cfrelease + 552 2 corefoundation 0x2e626702 -[__nsdi

mysql - Display database value in android app, how? -

i working on small application android, built mysql database , want display table values on screen.is there tutorial or template this? how can it.. i have following .java concerning database: databahsehander.java package com.minilotto.library; import java.util.hashmap; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class databasehandler extends sqliteopenhelper { // static variables // database version private static final int database_version = 1; // database name private static final string database_name = "android_api"; // login table name private static final string table_login = "login"; private static final string table_session = "session"; // login table columns names private static final string key_id = "id"; private static final str

Weceem plugin not rendering javascript -Grails 2.3.7 -

i got weceem-plugin (1.2) installed grails 2.3.7. runs fine except javascript not rendered - shows raw text. have confirmed static resources(css,images,js) loaded. in advance. the problem can solved without rebuilding existed plugin. can try update config.groovy in application. please, check demo application weceem on github, here can find config.groovy https://github.com/jcatalog/weceem-app/blob/master/grails-app/conf/config.groovy . application on grails-2.3.7. check setting: grails.resources.adhoc.excludes = ['/plugins/weceem-1.2'] also such settings grails.views.default.codec= "none" grails.views.gsp.codecs.scriptlet = "none"

mvvmcross - Spinner SelectedItem and ItemsSource -

i have deserialized spinner object, , loaded in view model (the property bound selecteditem). mvx keeps saying not find spinner object, spinner selecteditem cannot null. i realised deserialized spinner object not part of itemssource, since deserialized json. therefore searched corresponding item in itemssource , replaced selecteditem correct object. works. is there cleaner way of doing this? perhaps should implement iequatable in object. please advise. the deserialized spinner object not part of itemssource, since deserialized json. therefore searched corresponding item in itemssource , replaced selecteditem correct object. i'm not entirely sure asking. however, helps: there example of using equals provide object matching in spinner in https://github.com/mvvmcross/mvvmcross-tutorials/blob/master/apiexamples/apiexamples.core/viewmodels/viewmodels.cs#l105

ember.js - Ember model rollback prevents me from setting properties -

i have model that's being created in parent route. app.parentroute = ember.route.extend model: -> @store.createrecord('banana') when hit child route of parent route, i'd unsaved changed model dropped. app.childroute = ember.route.extend aftermodel: (banana) -> banana.rollback() the problem once rollback called, ember won't allow me set properties on it. when try, error: error: attempted handle event `didsetproperty` on <app.banana:ember296:null> while in state root.deleted.saved. called {name: color, oldvalue: undefined, originalvalue: undefined, value: yellow}. i read due kind of observer on object, don't have observers set up. missing? this fixed in ember data 1.0 beta 8, https://github.com/emberjs/data/blob/v1.0.0-beta.8/changelog.md , available here http://builds.emberjs.com/tags/v1.0.0-beta.8/ember-data.js

javascript - Node.JS + Passport.SocketIO: Edit And Save `socket.handshake.user` Properties -

i using node.js (0.10.28), passport.js (0.2.0) + passport-google (0.3.0), , passport.socketio (3.0.1). currently, able access user created passport.js in app's paths using req.user : app.get('/profile', function(req, res) { // send user data res.send(req.user); }); using passport.socketio, able access user in: io.sockets.on('connection', function(socket) { // user data console.log(socket.handshake.user); //... }); it possible edit req.user , 'save' using req._passport.session.user.property = new_property_value in app.get/post/all(...) scope. updates show in io.sockets.on(...) user object. my question is: possible edit , 'save' socket.handshake.user in io.sockets.on(...) scope updated user show changes in req.user in app.get/post/all(...) ? have tried following no avail: io.sockets.on('connection', function(socket) { // rename username socket.handshake.user.username = 'new_username'; //... })

wso2esb - WSO2 ESB Uri-template how to add optional query parameter -

i'm trying add optional query parameter api uri-template. http://myapi.com/v1/staff/{department}?filter=nerds so in case resource should possible called w/wo parameter http://myapi.com/v1/staff/it or http://myapi.com/v1/staff/it?filter=nerds my current uri-template /staff/{department}* this works parameters. calling resource without parameters no match. addition wildcard i've tried use optional query params defined in rfc 6570 http://tools.ietf.org/html/rfc6570#section-3.2.8 can't save api uri /staff/{department}{?filter} should work ? thanks help, kari one option, can define 2 resource blocks different uri_template pattern

rest - Handling inconsistent data between front-end and back-end -

i have been wondering quite while in following situation: user loads data on front-end , starts editing it second user same , and sends update stored in db end the first user sending updated data has been changed or not exist. what in such situations check in validation procedure on end, , if inconsistent return 409 http status message stating data has been changed(updated/deleted). on front-end notify user there have been changes applied data, , ask wants overwrite changes (or create new record if old 1 has been deleted). so question is, there better way or on right path here? if insist on using html statuses idea pretty good. not bother send different http statuses, rather use 200 , send in lines of {success: false, message: "reason not succeeding"}

listview - How to give a two different color to the list items of a customized list-view in android? -

Image
can tell me how give 2 different color list items of customized list-view in android? below image.is possible? suggestion please thanks precious time!.. this code you, insert code in custom list adapter, public class listadapter extends baseadapter{ context ctx; layoutinflater linflater; list<string> data; listadapter(context context, list<string> data) { ctx = context; this.data = data; linflater = (layoutinflater) ctx .getsystemservice(context.layout_inflater_service); } @override public int getcount() { return data.size(); } @override public object getitem(int position) { return data.get(position); } @override public long getitemid(int position) { return position; } @override public view getview(int position, view convertview, viewgroup parent) { view view = convertview; if (view == null) {

connect PostgreSql to Oracle live -

i have postgresql database , need connect read data oracle view , store data in custom table the postgresql database connect oracle everyday automatically read latest updates oracle view how create it? it sounds want sql/med foreign data wrapper . check out oracle_fdw . use generic odbc_fdw or jdbc_fdw wrappers via oracle's odbc or jdbc drivers. another option dbi-link. combine these cron job if want copy local view.

node.js - express not installed on my machine -

i downloaded node.js onto linux fedora core 18 machine. after using npm -g install express installed express. problem unable find express file supplied nodeclipse in preference. hence, application using express not able compile saying express not found. missing here? try installing command , see if works: npm install -g express then go cd myapp npm link express this trick..

postgresql - Query to match multiple column values with multiple rows -

i have following table in postgresql 9.1 table contact : contact_id phone mobile 1 123 456 2 111 222 3 333 123 4 222 444 table role : contact_fk exchange 7 1 8 2 1 4 5 5 2 4 4 5 i need result like: contact_id phone mobile exchange 1 123 456 4 3 333 123 4 2 111 222 4 i want contact data mobile field data in other contacts phone field , user must in exchange 4, available in contact_role table fyi: contact table contains around 50k rows joining contact table taking lot time, must apply contact_role condition together. joining 50k table 2 columns (where contact_fk primary) shouldn't take long time. select t1.contact_id, t1.phone, t1.mobile, t2.exchange contact t1 join ro

vba - Why are EXCEL XLSM format no longer a valid ZIP format? -

files saved in excel xlsm files no longer valid zip files, preventing editing of ribbon. xlsm files saved on or prior may 23, 2014, can renamed .zip , edited. xlsm files saved after may 23, 2014, cannot renamed .zip , edited, rather generate error message file corrupted archive. both windows explorer , winzip generate same error condition, though error message varies slightly. yes, there macros in files; opening old file macros (and vba) disabled , saving new name generates corrupted file. i have tested on 2 other machines in our corporate group, same results, not corruption on workstation. office diagnostics reports no problems excel. any thoughts on causes or solutions? update let's clear on test process: i rename xlsm file saved on may 23 .zip; creates zipped archive both winzip , windows explorer can open successfully. undo rename make file xlsm again. i open file above in excel-2007 and not enable macros or vba . save new filename xlsm file. i rename f

python - how to break out of this while loop -

guys trying break out of while loop.. starterp=input("would rather torchik, mudkip, or bulbasaur? choose wisely.") if starterp=='torchik' or starterp=='torchik': print("you have picked torchik!") if starterp=='mudkip' or starterp=='mudkip': print("you have picked mudkip!") if starterp=='bulbasaur' or starterp=='bulbasaur': print("you have picked bulbasaur!") i want program keep asking input if not enter 1 of choices. anytime enter right input matches 3 choices, break out of loop , continue next codes. you have 2 issues code: you not have loop @ all. should use while true you should use break break out of loop code: while true: starterp=input("would rather torchik, mudkip, or bulbasaur? choose wisely.") if starterp=='torchik' or starterp=='torchik': print("you have picked torchik!")

VB.Net Iterate through two listboxes -

i'm trying iterate through 2 listboxes , adding items 1 list. here's code far can't seem integrate second listbox it. dim list list(of string) = new list(of string) each lb1 string in listbox1.items list.add(vbtab + vbtab + "ent = maps\mp\_utility::createoneshoteffect(" + """" + lb1.tostring() + """" + ");" + vbcrlf + vbtab + vbtab + "ent.v[ " + """" + "origin" + """" + " ] = ( " + lb2.tostring() + " );" next as long lb1 , lb2 both contain same number of items , both ordered same, use indexed loop (instead of foreach loop): dim list list(of string) = new list(of string) x integer = 0 listbox1.items.count - 1 list.add(vbtab + vbtab + "ent = maps\mp\_utility::createoneshoteffect(""" + _ listbox1.items(x).tostring() + """);" + vbcrlf + _ vbtab + vbtab +

javascript - Angular js sort a list of items based on few conditions -

angular noob here i have angular app in plunkr . how sort list displayed here using angular such course flag stays on top , remaining items sorted alphabetically? you can use orderby. change ngrepeat this: <a ng-repeat="prog in programs | orderby:'academic_program.program_title' | orderby:'primary_program':true" href="#" ng-click="display.addprogram = false" class="list-group-item"> here's modified plunker: http://plnkr.co/edit/pjbvf5myge3ggd2ufkkf?p=preview

linux - Search for multiple terms in R -

i looking way search multiple terms egrep can in r. for example: cat fruit | egrep 'apples|grapes|oranges' you can in r, use grep function fruit<-c("apples","bananas","tomatoes","grapes") grep('apples|grapes|oranges', fruit, value=true) # [1] "apples" "grapes"

jquery - Tooltip not working the way it should in chrome -

following fiddle trying display tooltip on map tag of image. tooltip works fine if using firefox doesnot work fine on chrome. kindly take @ following fiddle , hover on edges of image , you'll see instead of bottom tooltip appearing @ top left. kindly let me know how can fix chrome: http://jsfiddle.net/4hptx/53/ <div class="pull-left"> <br> <br> <br> <br> <img width="54" height="17" border="0" style="margin-left:15px;" usemap="#map" alt="" src="http://www.dscl.org/etitles/device-apple-mac-button.jpg"> <map name="map"> <area href="#hmm" coords="2,0,21,19" shape="rect" title="" onclick="showsection('qal')" data-placement="bottom" data-toggle="tooltip" class="grid-menu" data-original-title="why not on bottom?">

c++ - Is it bad style to overload operators on std containers in global scope? -

i had problem arise: // a.h #include <vector> typedef std::vector<unsigned char> buffer; buffer &operator+=(buffer &a, buffer const &b); // b.h namespace bar { struct qux { }; qux &operator+=(qux &a, qux const &b); } // foo.cpp #include "a.h" #include "b.h" // comment out, error goes away namespace bar { void foo() { buffer a, b; += b; // error } } the problem (as described here ) a += b; fails compile because bar::operator+=(qux&, qux const &) hides ::operator+= ; , adl not find ::operator+ because adl searches namespace std; in case. this icky because problem appears if b.h included -- b.h apparently has nothing buffer . code shouldn't break depending on whether include header. (actually discovered when changing compilers, previous compiler using did name lookup incorrectly , accepted code). my question is: overload in a.h bad idea becau

android - corona simulator doesn't show full image -

Image
i'm creating simple game using corona. first thing i'm trying load background image; got that, corona simulator show small part of image @ top left side , rest of image stay black if used scaling mode , i'm sure image size. then added 3 parameter display.newimage method got better situation still have black bar on left. my config.lua application = { content = { fps = 60, width = 320, height = 480, scale = "zoomeven", -- xalign = "center", --yalign = "center", imagesuffix = { ["@2x"] = 2; }, }, } and main.lua local background = display.newimage("images/clouds.png"); first result on devices then made got better result make small edit main.lua local background = display.newimage("images/clouds.png",230,150, true); and second result you must modify anchor property, property allows control alignment of object along x or y direction. default, new

How to grab a sticky post in facebook page? -

i can grab posts of facebook page using facebook graph api,but don't know how grab sticky post possible? thanks, # page https://www.facebook.com/pages/ob%e5%9a%b4%e9%81%b8/397486643273 there has flag picture on upper right corner top of post http://i.stack.imgur.com/w2s9q.png its not possible determine, via graph api, if post on page has been pinned. there no way pinned posts page. for reference, here's more info pinned posts: https://www.facebook.com/help/235598533193464

c# - How to use Lambda to merge two Dictionary with List<string> contain in Dictionaries -

i have 2 dictionaries of type dictionary<string, list<string>> how merge these 2 dictionaries 1 dictionary dictionary<string, list<string>> . list<string> lsta = new list<string> { "a", "b", "c", "d" }; list<string> lstb = new list<string> { "1", "2", "3", "4" }; var dica = new dictionary<string, list<string>> { { "0", lsta } }; var dicb = new dictionary<string, list<string>> { { "0", lstb } }; var mergedic = dica.concat(dicb) .groupby(t => t.key) .todictionary(k => k.key, d => d.select(k => k.value) .tolist()); change d.select d.selectmany var mergedic = dica.concat(dicb) .groupby(t => t.key) .todictionary(k => k.key, d => d.selectmany(k => k.value) .tolist());

sql - Insert into from CTE -

dtl (select cmpi_code, cmn_cdty_mtrl, cmi_wt_factor, cmi_cntrct_rate, 'pl', present_price, trm_code, round(((nvl(present_price,1)*cmi_wt_factor) / cmi_cntrct_rate),2) pl_factor vw_cmd_material trm_code = 41) insert ipa_prcadj_hdr(trm_code,ipaph_adj_factor,ipaph_amt_cur,ipaph_remarks) select trm_code,sum(pl_factor) pl_factor,((sum(pl_factor)*10)) amt_cur,'asdf' dtl group (trm_code); showing error ora-00928: missing select keyword this syntax insert table cte: -- create table tmp ( tmp_id number(10) ); insert tmp( tmp_id ) cte ( select 1 tmp_id dual ) select tmp_id cte;

xsl fo - Limiting number of rows in a page -

i have table with, suppose, 20 rows , want table displayed such each page have 5 rows. 20 rows should displayed in 4 pages. using apache fop print pdf. can me out in this? this how achieved this. <xsl:choose> <xsl:when test="position() mod 4 = 0"> <!-- add table rows here property break-after--> <fo:table-row break-after="page"> <fo:table-cell> <xsl:text>table content here</xsl:text> </fo:table-cell> </fo:table-row> </xsl:when> <xsl:otherwise> <!-- add table rows here without property break-after--> <fo:table-row> <fo:table-cell> <xsl:text>table content here</xsl:text> </fo:table-cell> </fo:table-row> </xsl:otherwise> </xsl:choose>

Dandelion Datatables i18n spring resolver not working -

Image
i have started integrate datatables in spring mvc 4 + hibernate 4 + tiles 3 project. i want display header various language support. so started link . as per page suggests header shows ???key??? message. i want display id in column header showing ???table.header.id??? . this link says if key cannot found in bundle, ???key??? message displayed in column header. but have put following in datatables.properties i18n.locale.resolver=com.github.dandelion.datatables.extras.spring3.i18n.springlocaleresolver global.i18n.message.resolver=com.github.dandelion.datatables.extras.spring3.i18n.springmessageresolver also have put in global_en.properties table.header.id=id i copied same file global.properties .. not worked. my jsp file contains <datatables:table id="users" ...> <datatables:column titlekey="table.header.id" property="userid" /> <datatables:table /> my resource folder structure wher