Posts

Showing posts from June, 2014

Time to learn Cassandra/ MongoDB -

i going start learning nosql databases (in practices, done researches , understood concepts , modeling approaches). working time series data , both cassandra , mongodb recommended use case. know 1 takes less time learn? (unfortunately, don't have time spend on learning) ps: noticed there more tutorials , documentations mongodb (am correct?) thank you! having used them both extensively, can learning curve isn't bad might think. different people learn , absorb information @ different rates, difficult find easier or how pick them up. mention mongodb has reputation of being very developer-friendly, due fact can write code , store data without having define schema. cassandra has little steeper learning curve (imo). has been lessened due cql table-based column families in recent versions, bridge understanding gap between cassandra , relational database. since tutorials mongodb have been mentioned, post link datastax's ac*ademy , offers free online course ca...

c++ - Qt widget on top of other non qt window -

i'm developing plugin commercial program (i can't change it) use in windows operating system. in plugin create qt widget , when in main program button clicked, qt widget appears. my problem widget appears under main program window, while want on top of it. can stay on top, if necessary. qt::windowstaysontophint not seems work here because have no qt parents. i've found way put on top, following qt wiki , , i've created method call after widget constructor: void radiationpatternwidget::setwindowtopmost() { #ifdef q_ws_win32 hwnd hwnd = winid(); dword exstyle = ::getwindowlong(hwnd, gwl_exstyle); dword style = ::getwindowlong(hwnd, gwl_style); hwnd parent = null; if (parentwidget()) { parent = parentwidget()->winid(); } exstyle |= ws_ex_topmost; hwnd newhwnd = ::createwindowex(exstyle, l"#32770", null, style, cw_usedefault, cw_usedefault, cw_usedefault, cw_usedefault, parent, null, qwinappinst(), null); create...

Errors in Data Structure program using C to concatenate two strings -

#include<stdio.h> #include<conio.h> #include<string.h> void main() { char *s1, *s2, *s3; int length, len1=0,len2=0, i, j; clrscr(); s1=(char*)malloc(20* sizeof(s1)); s2=(char*)malloc(20* sizeof(s2)); printf("enter first string\n"); gets(s1); len1=strlen(s1); printf("enter second string\n"); gets(s2); len2=strlen(s2); length=len1+len2; s3= (char*)malloc((length+2)* sizeof(s3)); for(i=0;i<len1;++i) *(s3+i) =*(s1+i); *(s3+i)=' '; /*leave space @ end of first string */ ++i; for(j=0;j<len2;++j) { *(s3+i)=*(s2+j); /* copying 2nd string */ ++i; } *(s3+i)='\0'; /* store '\0' @ end set 'end of string' */ printf("concatenated string is\n%s", s3); getch(); } can please point out errors in code, used concatenate 2 strings... showing many errors first asking prototype malloc function.. by looking @ code can using turbo-c compiler. need add #includ...

sql server - What is the cost of file organizations: heap file, sorted file, unclustered hash index on a delete operation using equality condition on a key? -

i learning database right now. knows nothing sql server. :-p i see question don't know how answer it. consider delete operation specified using equality condition on key. assuming no record qualifies, cost 3 file organizations: heap file, sorted file, unclustered hash index? anyone answer question? thank :-) for sql server 2014 (you tagged sql server , there no nc hash indexes in sql server before), answer io cost heap table reading pages constitute table, clustered index (sorted file) depends on depth of b tree structure, , unclustered hash index lookup hash table. of these should include 1 or more reads on metadata pages (iam , such).

Passenger + nginx + Rails4 : 'Further configuration is required' (nginx's default page is shown) instead of my rails app -

i've installed passenger nginx on ubuntu (12.04) server. seems working fine (i.e. nginx firing w/o issues) except on browser i'm shown default nginx landing page ("welcome nginx! if see page, nginx web server installed , working. further configuration required." ) expecting rails app's home page on browser. following nginx.conf: user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings ## gzip on; gzip_di...

c# - Indent multiple lines of text -

i need indent multiple lines of text (in contrast this question single line of text ). let's input text: first line second line last line what need result: first line second line last line notice indentation in each line. this have far: var texttoindent = @"first line second line last line."; var splittedtext = texttoindent.split(new string[] {environment.newline}, stringsplitoptions.none); var indentamount = 4; var indent = new string(' ', indentamount); var sb = new stringbuilder(); foreach (var line in splittedtext) { sb.append(indent); sb.appendline(line); } var result = sb.tostring(); is there safer/simpler way it? my concern in split method, might tricky if text linux, mac or windows transfered, , new lines might not splitted correctly in target machine. since indenting lines, how doing like: var result = indent + texttoindent.replace("\n", "\n" + indent); which should cover bot...

oracle - How to debug this plsql code? -

i getting error while executing ps-sql procedure. below script. set serveroutput on size 100000 set echo off set feedback off set lines 300 declare cursor sessinfo select nvl(s.username, '(oracle)') username, s.osuser, s.sid, s.serial#, p.spid, s.status, s.module, s.machine, s.program, to_char(s.logon_time,'dd-mon-yyyy hh24:mi:ss') logon_time, s.last_call_et/3600 last_call_et_hrs, lpad(t.sql_text,30) "last sql" gv$session s, gv$sqlarea t, gv$process p s.sql_address = t.address , s.sql_hash_value =t.hash_value , p.addr=s.paddr , s.status='inactive' , s.last_call_et > (3600) order last_call_et; sess sessinfo%rowtype; sql_string1 varchar2(2000); sql_string2 varchar2(2000); begin open sessinfo; loop fetc...

Android Audio Recording -

i'm trying develop android app need user voice recording. see many code nothing work me.it open didn't record anything. here code: package com.example.record8; import java.io.file; import java.io.ioexception; import android.app.activity; import android.content.contentresolver; import android.content.contentvalues; import android.content.intent; import android.media.mediarecorder; import android.net.uri; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.util.log; import android.view.view; import android.widget.toast; public class mainactivity extends activity { mediarecorder recorder; file audiofile = null; private static final string tag = "soundrecordingactivity"; private view startbutton; private view stopbutton; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); startbutton = findviewbyid(r.id.btnsta...

video streaming - Android webview stop playing after a few seconds -

i trying play stream video in videoview. some videos stop playing after few seconds. getting following information in logcat : 04-05 21:36:28.991: w/audiosystem(9041): audioflinger server died! 04-05 21:36:28.991: w/imediadeathnotifier(9041): media server died 04-05 21:36:28.991: e/mediaplayer(9041): error (100, 0) 04-05 21:36:28.991: e/mediaplayer(9041): mediaserver died in 16 state 04-05 21:36:30.001: e/mediaplayer(9041): error (100,0) 04-05 21:36:30.001: d/videoview(9041): error: 100,0 below can find code i'm using play videos: string link = item.getvideourl(); videoview videoview =(videoview)view.findviewbyid(r.id.ivvideoplayer); mediacontroller mc = new mediacontroller(view.getcontext()); mc.setanchorview(videoview); mc.setmediaplayer(videoview); uri video = uri.parse(link); videoview.setmediacontroller(mc); videoview.setvideouri(video); videoview.requestfocus(); videoview.start(); return view; how can fix this? ...

ruby - Strange code execution: should assign one element, assigns all -

i trying write genetic algorithm function approximation. part of code responsible mutation of 1 gene changes whole chromosome array. changes array not used in part. here's code. print "\n\nchrom_array5: ", @chrom_array print "\n\nchrom_array5: ", @chrom_array random = rand if @no_of_chrom*@no_of_variables*@mutation_rate > random z=( rand * @no_of_chrom ).to_i print "\n\nz: ", z v=( rand * @no_of_variables).to_i print "\n\nv: ", v ble=new_chrom_array[0][0] print "\nnew_chrom_array[0][0]: ", new_chrom_array new_chrom_array[z][v] = ble + ble*rand - ble*random print "\nnew_chrom_array[z][v]: ", new_chrom_array end print "\n\nchrom_array6: ", @chrom_array print "\nnew_chrom_array6: ", new_chrom_array @chrom_array = new_chrom_array ... here's output mutating iteration: chro...

java - Force signature for couple of methods in class -

is possible force signature couple of methods in class? let's have interface myinterface: public interface myinterface { public void method(int a); } and want implement myinterface in class myinterfaceclass in way each method in myinterfaceclass got same signature? public class myinterfaceclass implements myinterface { public void method_a(int a) { /*something */ } public void method_b(int a) { /*something */ } public void method_c(int a, int b) { /*something */ } // error cause of signature, won't compile } i have unknown number of methods in myinterfaceclass . i can't tell after here? in java, method's signature made of 6 factors: privacy level (public, private, etc...) return type method name (cap sensitive) parameters (type , position, method_a(int a, string b) != method_a(string b, int a) ) checked exception list if wish implement method in interface, must match of these criteria including name. further, in cla...

javascript - Keydown event on contenteditable div and child span -

i have contenteditable div containing span , trace keydown events when typing in both div , span within div. everything seems work fine far in firefox in webkit browsers div keydown event seems override span event. there way fire keydown span whilst it's within div? ( demo ) html: <div id="cediv" contenteditable="true" tabindex="0" onkeydown="return fnkeydiv(event);"> put cursor/caret in contenteditable text , type characters or use arrow keys -- <span id="cespan" tabindex="0" onkeydown="return fnkeyspan(event);"> see happens when typing inside yellow text</span> -- it's not clear me : counter 2 works when click mouse inside yellow text put caret there, not when caret moved inside yellow text arrow keys .. , : counter 2 never work in webkit !? (in firefox does) </div> <hr /> <span id="st1" class="st"></span> : counter 1 : typing in total ...

eclipse - How to use eclim with gradle project -

my eclim setup working eclipse project. want use gradle build system. working libgdx framework , provide gradle templete project. there way use eclime + eclipse + gradle you should combine youcompleteme . what did use gdx-setup.jar create project. imported eclipse normal gradle project. closed eclipse , started elcimd. put "let g:eclimcompletionmethod = 'omnifunc'" in .vimrc file. followed elcim instructions use :createproject , it. this guide helpful: http://www.lucianofiandesio.com/vim-configuration-for-happy-java-coding

c# - how to fill the dropdownlist in grip grouping control using syncfusion in asp.net -

Image
i having grid grouping control in syncfusion asp.net first column cell type combobox.here need fill dropdownlist in pageload.i wrote below code: sqlcommand cmd = new sqlcommand("select item_id, item_name productsnrwmtrls item_ctgry in('r','b')", con); sqldataadapter da = new sqldataadapter(cmd); datatable dtlocl = new datatable(); da.fill(dtlocl); dropdownlist ddlrwmtrl1 = (dropdownlist)gridgroupingcontrol1.findcontrol("ddlrwmtrl"); ddlrwmtrl1.datatextfield = "item_name"; ddlrwmtrl1.datavaluefield = "item_id"; ddlrwmtrl1.datasource = dtlocl; ddlrwmtrl1.databind(); but @ line ddlrwmtrl1.datatextfield = "item_name"; showing error : object reference not set instance of object . you can fill dropdownlist in syncfusion gridgroupingcontrol using rowdatabound. add dropdown item template in aspx file: [**aspx**] <syncfusio...

java - Form Parameter Value Not being fetched -

i making web application using jsp , servlets.in form tried upload file , enter value in textbox.here form : <form method=post action="sharingfile" name="form1" id="form1" enctype="multipart/form-data"> <input type="file" name="file" value="file"> <input type="text" name="totalshares" size="20"> <input type="submit" value="next"> </form> and in sharingfile servlet wrote following code : string n = request.getparameter("totalshares"); servletfileupload upload = new servletfileupload(new diskfileitemfactory()); arraylist<string>filenamess=new arraylist<string>(); list<fileitem> files = new servletfileupload(new diskfileitemfactory()).parserequest(request); out.println(files.size()); iterator it= files.iterator(); while(it.hasnext()){ ...

javascript - Can you use = and == together in the same script? -

had problems script running, built around dropdown menus. single equals = , equals == both used in same function, though not same if statement. not see else amiss , made uses ==, seemed resolve problem. i'm relatively new javascript, wondering if combining different styles of equals makes difference all. didn't think did. your question doesn't make sense - these different operators. in javascript: = assignment operator, e.g. var x = 1; if (x = 1) // not compare x 1, assign value 1 x // , return value if block decide // whether value truthy or not (and in case // return true). == comparison operator, e.g. var x == 1; //this not make sense (or run) if (x == 1) { === comparison , ensures both operands same type: var x = "1"; if (x == 1) { //returns true if (x === 1) //returns false.

qemu - Transforming qcows2 snapshot plus backing file into standalone image file -

i have qemu qcow2 disk snapshot dev.img based off backing file dev.bak . how can merge both standalone devplus.img , while leaving dev.bak is? i got qemu mailing list: first copy original base file standalone image file: cp dev.bak devplus.img then "rebase" image file backed off original file uses new file: qemu-img rebase -b devplus.img dev.img then can commit changes in dev file new base: qemu-img commit dev.img now can use devplus.img standalone image file , rid of dev.img if wish, leaving original dev.bak intact , not corrupting other images based off it.

google maps - Get StopID from of TransitStop -

Image
i'm using google directions api, using 'transit' mode. part of result transit_details object, contains stops information ( arrival_stop & departure_stop ). the questions how can stopid? *_stop objects contain location , name. on maps.google.com though, results contain stop id. google transit_details: "transit_details" : { "arrival_stop" : { "location" : { "lat" : 32.181194, "lng" : 34.871078 }, "name" : "xxxx" } here can see i'm speaking of. chose arbitrary station on google maps, , can see gives stop id it. unfortunately there no way right now. google doesn't provide details yet sadly.

java - EJB 3 Eager loading -

i work ejb 3. have base class , there dependency classes b,c,d @entity @table(name = "a") public class implements serializable { @onetomany(cascade = cascadetype.all) private list<b> bs; @onetomany(cascade = cascadetype.all) private list<c> cs; @onetomany(cascade = cascadetype.all) private list<d> ds; } i have question. how can load tables eagerly? want use em.find(a.class, id); you must use fetch attribute in onetomany annotation so: @entity @table(name = "a") public class implements serializable { @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager) private list<b> bs; @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager) private list<c> cs; @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager) private list<d> ds; }

How do I create an object from parsing FIX XML data in C++? -

Image
the xml below represents fix message. message has variable number of fields (numbered using id tag), each containing differing attributes. parse xml , additional coding abilities output c++ message object includes attribute information per field. first question be- there boost library can use this? second question interface between xml parser can provide , have write code create objects. example, in xml on line 8 there <delta/> tag , attribute of object. field 52 (line 8) attribute delta sub type object line 9 attribute copy subtype object. store these subtypes in std::unordered_map field id being key. i guess way of wording is- "end result" xml parser give me build objects way want them? you should use 1 of many commonly-used xml parsers, xerces , tinyxml 2 possibilities. there more. google friend. you want run in sax mode rather dom mode (the documentation parser choose explain). means parser call code supply each element , attribute parses ...

floating point - Howto best pack 2 texture coordinates for fast vertex buffer processing ? (WebGL GPU Float Packing) -

i wondering way smartes pack 2 texture coords fast usage in vertex shaders given following circumstances: both texture coords can either 1.0f or 0.0f => 1 bit each enough i have pack 2 coords glbyte (8 bit) attribute variable; best if 6 bits remain available other usages my issues i'm not familiar bit-layout of floats myself, can imagine 1 bit in 0.0f needs flipped become 1.0f - dunno one; using bitwise ops should incredible fast (btw: gpu's faster bitwise stuff compared arithmetic, cpus ?). it's done this, in vertex shader: uv = fract(vertex.xy); normal = fract(vertex.z); gl_position = mvp * vec4(floor(vertex), 1.0) obviously, vertex xyz must scaled before storing vbo maximum texture resolution, 256x256 in case: vbo.push_back(vertex.mul_xyz_scalar(256.0).floor().add_xyz(uv.x, uv.y, normal)); so, if vertex.x .00390625, becomes 1. positions below 1/256 subnormals (lost, floor above truncates it). uv assumed in 0-1 range. if insist, can multiply...

java - Adding Extensions of JPanel to JFrame -

i have class contains main gui window program display /** * gui program run coffee/bagel shoppe * @author nick gilbert */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class coffeeshop extends jpanel { private final int window_width = 400; // window width private final int window_height = 300; // window height private jframe mainframe; public coffeeshop() { //setting mainframe configurations mainframe = new jframe(); mainframe.settitle("order entry screen!"); mainframe.setsize(window_width, window_height); mainframe.setdefaultcloseoperation(jframe.exit_on_close); mainframe.setlayout(new borderlayout()); //piecing gui window mainframe.add(new titleregister(), borderlayout.north); mainframe.setvisible(true); } public static void main(string[] args) { new coffeeshop(); } } as can see, i'm trying add mainframe jpanel cl...

c# - GridSplitter like for listview: Is there any such control? -

i have listview want give user chance resize height of items similar gridsplitter. there such control purpose? i using wpf , .net 4.5, c# what can use canvas 2 listviews, , use thumb control allow resize listviews. thumb control: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.thumb(v=vs.110).aspx

sugarcrm - Sugar CRM 7 enterprise uninstall -

i want uninstall sugarcrm 7 , reinstall. my config files set xampp php , apache. i've tried renaming folder , running localhost/sugarcrm sugarcrm folder installation if want uninstall sugar delete sugar directory web root. if want reinstall on top can set 'installer_locked' => false in config.php , navigate install.php in browser.

Twilio conference - Handle no one answering -

i want main number call 2 people , have them placed conference. question how handle if 1 or both people don't answer phone. if person joins , waiting person b , don't pick up, conference end? person waiting indefinitely? not sure best practice gracefully handle situation. thanks, ee twilio evangelist here. if you're placing outbound calls via rest api , dropping them conference when answer yes, persona wait indefinitely in conference call (actually 4 hours since max call length allowed). what can include statuscallback parameter when initiate outbound phone call. twilio make request url when call ends (or never answered) , pass part of request url callstatus parameter tell why call ended. you can use value of callstatus redirect person out of conference if needed. hope helps.

qt - How to show the menu in QPushButton without blocking? -

i use qt4 qpushbutton qmenu in (set setmenu() ). need show menu when unrelated event occurs. method qpushbutton::showmenu() this, blocks until user closes menu. qmenu::show() this, shows menu in top left corner of screen. how can programmatically make menu show positioned, , without blocking? qmenu qwidget . can call move() before show() .

google api java client - GoogleApiClient.isConnected() returns true in airplane mode -

we're experiencing following behavior doesn't seem make sense: attempt connect instance of googleapiclient succeeds , calling isconnected() in our instance of googleapiclient returns true when it's clear client cannot connected service. in order confirm behavior enabled airplane mode before starting app , i'm printing value returned isconnected() equals true . so i'm confused. expected behavior or bug? reporting successful connection because api handles being offline transparently? this isconnected() call has nothing whether device has connectivitiy, explains whether connected google play services service on device itself . there number of operations can't performed until you've connected service, can performed whether or not user online (e.g. writing plus moments). there no call determine if user connected internet because there known ways that, , connection tenuous. because user connected when start activity doesn't mean they...

serialization - java.io.StreamCorruptedException:unexpected reset; recursion depth 1 -

i'm trying write , read 1 file objectinputstream , objectoutputstream, in 2 threads. since have append file, according online advise, implement class: public class appendableobjectoutputstream extends objectoutputstream { public appendableobjectoutputstream(outputstream out) throws ioexception { super(out); } protected void writestreamheader() throws ioexception { reset(); } } and write logic like: synchronized (sdklogger.failoverfile) { fileoutputstream fos = null; objectoutputstream oos = null; try { if (failoverfile.exists()) { fos = new fileoutputstream(sdklogger.failoverfile, true); oos = new appendableobjectoutputstream(fos); } else { fos = new fileoutputstream(sdklogger.failoverfile, true); oos = new objectoutputstream(fos); } (logmodel log : logs) oos.writeobject(log); because have synchronized on globa...

c# - ilnumerics matrix multiplication operator -

ilnumerics great, , it. however, matrix multiplication operator * set ilmath.multiplyelem, element wise multiplication. wonder why not make ilmath.multiply, normal matrix multiplication consistent matlab, , more natural use. in mathematics, element wise multiplication less used. think better change * behavior normal matrix multiplication. here common examples, suggestion give less convenience: ilarray<double> = rand(100,200) * 10 - 5; // square of a = * a; // multidimensional arrays rand(10,20,5) * ... // vector expansion b = * linspace(0.0, 9.0, 100); in mathematics, element wise multiplication less used are positive that? heavily depends on domain, suppose. the decision has been discussed. , suggestion major breaking change. can open feature request , collect votes it: http://ilnumerics.net/mantis

php - Tuleap Card Fields Error -

i have created task , set start date (08.04.2014) , end date(08.04.2014) same date, hence in card fields(included start date , end date fields) shows 8 hrs ago, instead of showing 8 hrs more day ends @ midnight 12. when set both dates days gap between them, works fine showing 1 day ago , 1 day more. please provide solution this. sounds bug. suggest report in request tracker

ios - NSUndoManager : revert all the functionality of method -

i search lot can't more detail want. is possible reverse functionality performed method of nsundomanager class. for example : suppose deleting row table view or remove subview superview in method. can reverse things of nsundomanager . is preparewithinvocationtarget method of nsundomanager can helpful ? any appreciated. thanks in advance !!! this document has all answers ! introduction undo architecture

XML error: Not well-formed (invalid token) phpldapadmin -

i trying set ldap server , manage phpldapadmin. if open element in tree or try create new element getting error. xml error: not well-formed (invalid token) @ line 1 in file /var/hda/web-apps/phpldapadmin/html/phpldapadmin/templates/creation/._sendmailvirtualdomain.xml if uncomment , set $config->custom->appearance['custom_templates_only'] = true in config file, able see tree element , create new elements, limited templates custom. any way of fixing this? is causing problem? question getting bit old, here's answer. there junk files in template directory software trying read in. try removing files , i'd bet work rm -f /var/hda/web-apps/phpldapadmin/html/phpldapadmin/templates/creation/._* rm -f /var/hda/web-apps/phpldapadmin/html/phpldapadmin/templates/modification/._* i used have these sorts of hidden files pop time when editing files windows share on mac. not sure if you've got similar going on or not...

java - Run Jar file with more than one argument -

Image
i building optimization jpeg-encoder written in java. benchmark want extract orginal code , optimized code separated jars. each jar has take 2 arguments. first on file name , secound repeat of compression of jpeg. public static void main(string[] args) { string filepath = args[0]; try { int times = integer.getinteger(args[1]); runbenchmark(filepath, times); } catch(ioexception | numberformatexception ioe) { system.out.println("your arguments wrong! use follow order!"); system.out.println("1. argument must filename of image."); system.out.println("2. argument must number repeat compression."); } } this main, witch handle args. cant run arguments on intellj . if compile jar, cant pass arg2. i passed 2 arguments via configuration in intellj , nullpointerexception. tried figure out if java can take 2 arguments. wrote simple main in vim , compiled ran 2 args , worked. repeated in new project in i...

ajax - Is it possible to enable javascript in browser using server-side code? -

most of pages of website called using ajax. if disable javascript in browser them ajax functionality not work. there way of enabling javascript in browser using server-side code.(or language c#)? no, there no way that.

android - Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode and Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode -

Image
i created android application , try add admob it. not works. can me fix error. [2014-04-09 15:16:51 - dex loader] unable execute dex: multiple dex files define lcom/google/ads/adrequest$errorcode; [2014-04-09 15:16:51 - aurudhu_app] conversion dalvik format failed: unable execute dex: multiple dex files define lcom/google/ads/adrequest$errorcode; this application architecture. google-pay-services.jar , googleadmobadssdk.jar having same class name admob. may due reason getting multiple .dex files. please follow docs steps of this sample code link of admob using google-pay-services.jar instead of googleadmobadssdk.jar. hope you, still have problem let me know...

c# - Flattening multiple tables to a single type -

i'm trying model database using entityframework's fluent configuration. cannot edit or otherwise control database schema. entity trying model has lot of look-up tables - example, 1 property (it's name) has whole table devoted name associated id (which it's language). in other words, looks bit in database: entity string[] names entity_names string name int languageid // 9 = english however, trying condense into entity string name // want english name using sql query, pretty simple - how can via entity framework's fluent configurations? there lot more of these instances well, simplest example come with. if manage flatten model way, it's going read-only view of data. there's no way entity framework know string property should looked in table , replaced integer id. so leaves 2 options if you're okay being view-only. write database view replaces ids strings , build entity view. or build entities compatible schema model...

c# - How i can use five different SQl Queries in the same gridview from the same table -

how can use 5 different sql queries in same gridview same table different parameters select count(distinct callingnumber) uniquecaller,count(callingnumber) numberofcall fcr1 callnumberpercallreason >15; select count(distinct callingnumber) uniquecaller,count(callingnumber) numberofcall fcr1 callnumberpercallreason between 2 , 6 , callreasonname='mobile/gsm>vas-crbt>crbt service deactivation'; =========output============ calling frequency unique caller no of call 15 7 116 b/n 14-11 11 133 b/n 10-8 50 412 b/n 7-2 8528 20635 1 times 46219 46219 total 54815 67515 if columns same can use union between 2 queries this: select count(distinct callingnumber) uniquecaller,count(callingnumber) numberofcall fcr1 callnumberpercallreason >15; union select count(distinct callingnumber) uniquecaller,co...

c# - Memory dump debugging causes error in Windows Store apps -

Image
i working windows store applications development. when try debug memory dumps, getting exception new me. can please me on this. i using visualstudio 2013. using 3 pcl libraries 4.5 higher framework. can please 1 me on ?

html - Stacking div elements within adjusting container -

i having troubles on how structure new widget working on. trying implement geographic map contains hotspots, old school image map. however, various purposes, want accomplish without use of image maps. so far, have gotten incomplete solution: http://jsfiddle.net/nielsbuus/fzj8e/1/ html: <div class="parent"> <!-- i'm container, need expand in height, when children expand, don't overlap elements beneath me. sort of clearing floats --> <div class="lower"> <!-- contain image. width fixed, height may vary. --> <img src="http://placekitten.com/300/325" /> </div> <div class="higher-container"> <div style="top: 20px; left: 30px" class="higher-spot">foo</div> <div style="top: 80px; left: 50px" class="higher-spot">bar</div> <div style="top: 85px; left: 70px" class=...

Python regex, how to capture multiple rules from 1 string -

got quick question here regex. have file(testlog-date.log) has lines this # 2014-04-09 16:43:15,136|pid: 1371|info|test.controller.root|finished processing request in 0.003355s https://website/heartbeat i'm looking use regex capture pid , time. far have this import re file_handler = open("testlog-20140409.log", "r") line in file_handler: var1 = re.findall(r'(\d+.\d+)s', line) print var1 file_handler.close() so i'm able print process time..question how capture pid (and possibly other information variable var1? tried doing var1 = re.findall(r'pid: (\d+) (\d+.\d+)s', line) it prints out empty structures. much appreciated thanks! followup: file quite large. i'm thinking of storing data 1 structure , sort them using process time, , print out top 20. idea how properly? use regex (.*)\|(pid: .*)\|(.*)\|(.*)\|(.*) . each parenthesis in regex pattern denotes separate group. in [125]: text = ...

java - Difference between @VisibleForTesting and @Deprecated int unit test -

let's there happens existing long private method (one of i'm not allowed refactor smaller pieces @ stage in development process) want write couple of regression-protection unit test it, now. i heard of @visiblefortesting annotation, not sure of benefits , gotchas. previously, had been marking things @deprecated , comments try , make clear like: ... code ... // ====================================== testing use below ====================================== @deprecated // testing only, not use! boolean testgiveaccesstosomethingprivate() { // call private method , results } it seems whenever mark @visiblefortesting seems expose method realz, without indication user of api method meant testing... (whereas if mark method @deprecated , ides put strike-through warns other developers not accidentally use test method actual code @deprecated when method marked @deprecated , programmers use method know maybe method removed, different behavior ... in future ...

how to replace comma with semicolon and remove double quotes in file using a bat file -

actually poor @ batch programming... i have csv file in data this "column1","column2","column2" "value1","value2","value3" i have replace comma semicolon , remove double quotes. my output should this.. column1;column2;column2 value1;value2;value3 i have tried this.. @echo off setlocal enabledelayedexpansion /f "delims==" %%a in (input.csv) ( set string=%%a & echo !string:,=;! >> output.csv ) it replacing comma semicolon (i dont know how is) how remove double quotes.... @echo off setlocal enableextensions disabledelayedexpansion (for /f tokens^=1^-3delims^=^,^" %%a in (input.csv) ( echo(%%a;%%b;%%c ))>output.csv it real case simple has been posted, define "problematic" characters delimiters in for command them removed.

javascript - Action isn't call functions on view, from template - Ember -

so create view (i create need act pop up) application.container = ember.containerview.create(); application.container.append(); application.loginoverlay = application.loginoverlayview.create({ }); application.childviews = application.container.get('childviews'); application.childviews.pushobject(application.loginoverlay); i have view looks application.loginoverlayview = ember.view.extend({ templatename: 'view/loginoverlay', password: null, logbackin: function (password) { console.log('logbackin'); }, closeoverlay: function () { console.log('closeoverlay'); }, username: function () { return application.user.get('username'); }.property().volatile() }); here's template <div id="login-overlay" class="overlay"> <section> <form id="login_form"> <div class="control-group"> <label class="cont...

java - Load big Images in Android -

it known android has issues storing bitmap data in ram memory. need load image (a photo 13mpx camera) on view , need able zoom-in , zoom-out image. image should mutable. implemented way: bitmapfactory.options options = new bitmapfactory.options(); options.inmutable = true; _bitmap = bitmapfactory.decodefile(_path, options); when take large photo (13 or 8 mpx) programm crushed "out of memory" error. need solution problem. need class can load , operate (scaling it) big images. it's needed equal or less api-8. i tried universall image loader, has no scaling option. know ideas how solve problem? a bitmap takes 4 bytes per pixel ==> 13mp equals 52mb of memory. should use bitmapfactory.options size first. using injustdecodebounds bitmap object meta data, without actual image. bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; bitmapfactory.decoderesource(getresources(), r.id.myimage, options); int imageheigh...

python - scraping site to move data to multiple csv columns -

scraping page multiple categories csv. succeeding in getting first category column, second column data not writing csv. code using: import urllib2 import csv bs4 import beautifulsoup url = "http://digitalstorage.journalism.cuny.edu/sandeepjunnarkar/tests/jazz.html" page = urllib2.urlopen(url) soup_jazz = beautifulsoup(page) all_years = soup_jazz.find_all("td",class_="views-field views-field-year") all_category = soup_jazz.find_all("td",class_="views-field views-field-category-code") open("jazz.csv", 'w') f: csv_writer = csv.writer(f) csv_writer.writerow([u'year won', u'category']) years in all_years: year_won = years.string if year_won: csv_writer.writerow([year_won.encode('utf-8')]) categories in all_category: category_won = categories.string if category_won: csv_writer.writerow([category_won.encode('utf-8')])...

java - Refreshing android app -

i have android app gets data mysql database, want implement refreshing capabilities such when new entry entered int database having app able see new entry after without restarting app again. how can that.? i have tried use intent = getintent(); finish(); startactivity(i); but not want refresh activity not load new entries. you have implement code fetch new data db , update entries in onresume() method of activity code work. if entries, using listview , use adapter.notifydatasetchanged() refresh data without having finish , restart entire activity. (taken this post )

javascript - Getting a syntax error, saying my function is undefined -

very unfamiliar javascript, i'm pretty sure should work of course isn't. little spotting error please. function calcshipping() { var purchaseprice = document.input.purchaseprice.value; var shippingprice; if (purchaseprice < 25) { shippingprice = 1.5; } else { shippingprice = (purchaseprice * .10 ) } var totalprice = (purchaseprice + shippingprice) document.input.total.value = totalprice; } //--> </script> <body> <h1>shipping , handling calculator</h1> <form name="input"> purchase price:<input type="text" name="purchaseprice" size="15"><br /> <input type="button" value="shipping calculation" onclick="calcshipping()"><br /><br /> total cost:<input type="text" name="total" size="15"><br /> </form> you need separate lines here: var totalprice = (purchaseprice ...

javascript - Position an element in the middle of header -

how can make work in firefox? want p element positioned vertically in middle of header . header need stay absolute positioned http://jsfiddle.net/a65tr/ html <header> <p>text text text text text text text</p> </header> css header { color: #3b4043; font-family: 'source_sans_prolight',sans-serif; font-size: 36px; height: 234px; left: 0; margin: 0 auto; position: absolute; right: 0; text-align: center; text-transform: uppercase; top: 0; width: 100%; background: green; } header p { bottom: 0; display: inline-table; left: 0; margin: auto; position: absolute; right: 0; top: 0; width: 100%; } use vertical-align center , delete position of p tag , problem solved ! demo : jsfiddle try css code here : header { color: #3b4043; font-family: 'source_sans_prolight',sans-serif; font-size: 36px; height: 234px; left: 0; ...

Check Word 2007 bookmark content and do something if it exists -

is possible search content inside bookmark , if exists, something. for example, if there word document bookmark named bookmark1. enclosing text bookmark1 created highlighting the text "entered text goes here". want create macro check see if text inside bookmark changed, , if not, delete text, bookmark, section break before it. the code below except deletes bookmark if text different because looking name of bookmark, not content. if activedocument.bookmarks.exists("bookmark1") = true activedocument.bookmarks("bookmark1").select selection.delete selection .endkey unit:=wdstory .typebackspace .delete end end if i want if statement like: if text inside bookmark1 = "entered text goes here" stuff below, else quit. ideas anyone? word 2007. the below should work if document set how think is, otherwise need have play around it: 'testtxt default text in bookmark (assuming not inclu...

go - Statically typed definitions vs dynamic lookup -

on book the go programming language phrasebook said: if require performance, can use statically typed definitions , avoid dynamic lookup. if require flexibility, can use late binding mechanism of interfaces can explain me "statically typed definitions" , "dynamic lookup" methods , functions in go? imagine have following code: type struct {} func (a a) foo() { fmt.println("foo called") } type interface { foo() } i can create variable of type a , call method: a := a{} a.foo() the compiler knows static type of variable, knows method call refers a.foo method. can compile above code use direct call a.foo , fast normal function call. if instead use variable of type i , things different: var i = a{} i.foo() the variable i can hold type has foo method. in particular case holding a value, won't know @ compile time. instead compiler generates code check dynamic type of i , associated foo method , call ...

actionscript 3 - Convert an Object's Name to a String -

var variable:object=new object(); how convert "variable" object "variable" string? thought work: var variable:object=new object(); var variable_string=string(variable); you cannot name of variable holds instance via said instance. you store instance in object against given key, found using for...in loop: var myobject:object = {}; var objects:object = { variable: myobject }; for(var i:string in objects) { if(objects[i] === myobject) { trace(i); // variable break; } }

java - Linux VIRT memory while running JAR file -

i have jar pretty lightweight, thing virt memory in linux increasing , never going down, thinking had memory leak started seeing memory increase happening every time printed out console. (since app monitoring it's printing console) could console printing? or i'm missing leak somewhere? i had memory leak, re-creating objects witout destroying. closed.

wampserver - Phpmyadmin access denied -

error mysql said: documentation 2002 - no connection made because target machine actively refused it. the server not responding (or local server's socket not correctly configured). normally because browser getting ipv6 version of localhost ip address , phpmyadmin config not setup allow address access. edit \wamp\alias\phpmyadmin.conf , change : if using apache 2.2.x <directory "d:/wamp/apps/phpmyadmin3.5.1/"> options indexes followsymlinks multiviews allowoverride order deny,allow deny allow 127.0.0.1 </directory> to <directory "d:/wamp/apps/phpmyadmin3.5.1/"> options indexes followsymlinks multiviews allowoverride order deny,allow deny allow 127.0.0.1 localhost ::1 </directory> if using apache 2.4.x change <directory "d:/wamp/apps/phpmyadmin4.0.4/"> options indexes followsymlinks execcgi allowoverride order deny,allow deny allow 1...

resize - WinRT Surface DirectX Black Screen -

i'm having strange , irritating problem on winrt surface tablet when using directx (hosted in backgroundswapchainpanel). once in while (like once day, or few times week / while testing few hours every day), half of 3d scene goes black, on picture below (cut vertically or horizontally): http://www.zurawcli.vot.pl/dxproblem.jpg while happens, directx still rensponsive , have full control of app. don't think posting code makes sense ( i'm using standard swapchain , resizing viewport , texture whenever screen size changes - getting screen size core window). happens once in while : ( when try explicitly force - splitting screen between 2 / switching between apps / , on, cannot repeat error - viewport resizes correctly. using app, happen. did had experience similliar ? ideas causing ? in advance, cheers

ios - How to create xml file -

i need make xml file looks this: > <message xmlns="client" > from="from_user" to="to_user" > type="chat"><properties > xmlns="@"http://software""><property><name>assetid</name><value > type="string">5346879f73322e08db030000</value></property><property><name>status</name><value > type="string">success</value></property><property><name>long</name><value > type="double">22.3451</value></property> > <property><name>lan</name><value type="double">3456</value></property> > </properties></message> i don't know how it. me? either create in notepad or learn xsd , generate it. check http://www.w3schools.com/xml/default.asp and when done, learn this: http://www.w3schools.com/schema/...

sql - MySQL Version 5.5.37: Dropping tables older than 30 days using CURSOR -

i've been researching trying find way fetch rows query result , process them individually. i've written script thought work apparently not. the script: declare @name char(20); declare c1 cursor read_only select table_name information_schema.tables table_schema = 'puslogger' , update_time < (now() - interval 30 day) open c1; fetch next c1 @table_name while @@fetch_status = 0 begin prepare stmt "concat('drop table if exists `', @table_name,'`;')" execute stmt dealloctate stmt fetch next c1 @table_name end close c1 deallocate c1 the script intended drop tables older 30 days. although doesn't seem work mysql version 5.5.37. i'm new mysql , i'm running server mysql windows (xp). perhaps syntax cursors isn't correct corresponding server version? i'm not sure i'd happy if me out. edit: this error message returned when try execute script sql command line: error 1064 (42000): have error in sql syn...

image - How to get bits of an 8-bit binary column array into separate columns or separate arrays? -

consider following array: >> a=[26;94;32]; >> b=dec2bin(a,8); >> c=str2num(b); >> d1=bitget(c,1); >> d2=bitget(c,2); >> d3=bitget(c,3); >> d4=bitget(c,4); >> d5=bitget(c,5); >> d6=bitget(c,6); >> d7=bitget(c,7); >> d8=bitget(c,8); >> e1=bitget(a,1); >> e2=bitget(a,2); >> e3=bitget(a,3); >> e4=bitget(a,4); >> e5=bitget(a,5); >> e6=bitget(a,6); >> e7=bitget(a,7); >> e8=bitget(a,8); i expect these results code: d1 = e1 d2 = e2 d3 = e3 d4 = e4 d5 = e5 d6 = e6 d7 = e7 d8 = e8 but have results: d1 = e1 d2 = e2 d3 = e3 d4 != e4 d5 != e5 d6 != e6 d7 != e7 d8 != e8 could please tell me why? in fact want separately write bits of b or c in different columns of array or in different column arrays , use in bitplane slicing. don't want use bitget directly ( it's homework assignment of image processing class , professor has emphasized on not usi...