Posts

Showing posts from January, 2014

visual c++ - Cannot register COM DLL built with VS2012/VC++ on 32-bit machine -

Image
i built c++ based com object using visual studio 2012. registers , works fine on 64-bit machines (called 32-bit code , calling 32-bit out-of-process com server) not register on 32-bit machines (neither xp nor win7 32-bit). message regsvr32 is loadlibrary("comobj.dll") failed - specified procedure not found. the project built visual studio 6 (7 years ago). uses atl macros such begin_com_map , begin_sink_map declare implementation of various interfaces. had re-compiled because com server invoking changed (new progid, new guid, new type library, etc). other making adjustments, , using current vs, there no (intentional) changes -- there nothing in old equivalent of project file have pointed 64-bitness. examining dll 64-bit version of depends.exe shows "64" icons next standard referenced dlls kernel32 , user32. other having built dll on 64-bit machine, there nothing "64-bit" dll can find. target explicitly win32 (not x64). examining dll 32-bit versi...

cordova - can we upload image and video directly to Facebook using phonegap -

i'm new phone gap please give me tutorial link facebook image , video upload gallery or recorded camera.thnks phonegap (now cordova) has officially supported facebook plugin can found here: https://github.com/phonegap-build/facebookconnect it offers complete integration fb api, can accomplish regular tasks such image upload.

batch file - How let cmd output less info -

i have batch file, example: test.bat , there 1 command in it: echo hello then run it: d:\cmd\test.bat then outputs result: //output begin -- blank line, don't want d:\cmd\echo hello -- not want hello -- want print line -- blank line, don't want neither. //output end i want print output of commands run in batch file, here echo command. but, there 2 blank lines, 1 @ head of result, , other 1 @ end of result. , d:\cmd\echo hello in result neither not want. what should do? great, in advance. just put @echo off in first line of batch file. prevent output of command's invocation when run (as prepending command @), eliminates lines bother you. taken http://ss64.com/nt/echo.html type echo without parameters display current echo setting (on or off). in batch files want echo off, turning on can useful when debugging problematic batch script. in batch file, @ symbol same echo off ...

Share mp3 via whatsapp, Android -

i'm developing application has share mp3 file via whatsapp. my code @ moment following: final intent shareintent = new intent(android.content.intent.action_send); shareintent.settype("audio/mp3"); shareintent.setpackage("com.whatsapp"); uri recurso = uri.parse("android.resource://com.yayo.yayobotonera/" + r.raw.audio1); shareintent.putextra(android.content.intent.extra_stream, recurso); startactivity(intent.createchooser(shareintent, getstring(r.string.text1))); i can share via gmail, example, it's not working via whatsapp. problem of code or whatsapp doesn't allow share mp3 files? thanks in advance! use this:: final intent sendintent = new intent(intent.action_send); sendintent.putextra("sms_body", "bod of sms"); sendintent.settype("*/*"); sendintent.setclassname("com.android.mms", "com.android.mms.ui.composemessageactivity...

asp.net mvc - Json response not getting updated in Firefox -

i have html span (class: displaytext) in mvc view has "typeid", , "idvalue" attributes. objective fetch displaytext property database table passed "typeid" , "idvalue". i have number of such span in view, call following method in document.ready() function display text , show on view, users don't need wait. $('span.displaytext').each( function (index) { var url = $('#urlgetdisplayname').val(); $.ajax({ type: "get", url: url, data: ({ typeid: $(this).attr('typeid'), value: $(this).attr('idvalue') }), success: function (result) { $('span.displaytext')[index].innertext = result; } }); }) in above code, urlgetdisplayname id of hiddenfield on mvc view contains url of following mvc controller action responsible bring display value database. [httpget] public virtual jsonresult getdisplaytextbytype(string ty...

Injecting blueprint OSGi service into JSF/PrimeFaces bean -

i have project built on top osgi , karaf server. dependency injection using aries blueprint. main part of project apache camel routes , integration things, need create maintenance web interface. give try jsf - primefaces implementation. able create demo, works in osgi under karaf, that's ok. now i'd know if it's possible use blueprint here, reference existing osgi services have , inject service jsf bean, can benefit written code. can me, please? we solved in following way: we created listener that: creates servicetracker tracks blueprintcontainer service attached same bundle puts servicetracker servletcontext attributes we created elresolver uses servicetracker , if there blueprintcontainer available uses getcomponentinstance of value the listener opens servicetracer during application initialization , closes during application destroy our listener class: https://source.everit.biz/svn/everit-util/trunk/core/src/main/java/org/everit/util/core/serv...

php - Using next in foreach loop -

i looping through array using foreach. in particular situation need know value of next element before iteration comes that(like prediction) element. planning use function next() . in documentation noticed next() advances internal array pointer forward. next() behaves current(), 1 difference. advances internal array pointer 1 place forward before returning element value. means returns next array value , advances internal array pointer one. if affect foreach loop? it not affect loop if use in way <?php $lists = range('a', 'f'); foreach($lists &$value) { $next = current($lists); echo 'value: ' . $value . "\n" . 'next: ' . $next . "\n\n"; } output value: next: b value: b next: c value: c next: d value: d next: e value: e next: f value: f next:

c# - How to insert a new record which has a auto increment number as primary key? -

for example, have following table: customerinfo cus_id: auto increment, int, identity cus_name: nvarchar if use follow codes insert record "peter", string name = "peter"; datacontext dc = new datacontext(); customerinfo newcustomer = new customerinfo(); newcustomer.cus_name = name; dc.customerinfos.insertonsubmit(newcustomer); dc.submitchanges(); the following error returns, can't perform create, update, or delete operations on 'table(customerinfo)' because has no primary key. do need self-define cus_id or other solutions? thanks! first of linq-to-sql needs primary keys in order able inserts , updates, have add primary key in table. now, because auto incremented identity column, in dbml, have select column "cus_id" of "customerinfo" table , go properties , set following: auto generated value : true auto-sync : oninsert this ensure when insert new row new id.

xml - How to get maximum value under same node in xslt -

i have xml below : <report xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <name>hourlyreport</name> <id>8</id> <totalresults>1</totalresults> <totalpages>1</totalpages> <items> <item> <id>1</id> <hour0>23</hour0> <hour1>12</hour1> <hour2>7</hour2> <hour3>18</hour3> <hour4>32</hour4> . . . <hour20>28</hour20> <hour21>39</hour21> <hour22>51</hour22> <hour23>49</hour23> </item> </items> </report> i need maximum value above xml using xslt . in above case maximum value 51 . how can that? possible maximum value in xslt variable, can use else. not getting way. can use xslt version 1.0 or 2.0 . given xslt 2....

How to Disconnect from a database and go back to the default database in PostgreSQL? -

i'm using postgresql version : postgres=# select version(); version ------------------------------------------------------------- postgresql 9.2.4, compiled visual c++ build 1600, 64-bit (1 row) i had connected database postgres=# newdb=# .... i'm in newdb=# database want disconnect , go postgres=# database .... how ? i have tried disconnect newdb; but giving erroe as:: postgres=# create database newdb; create database postgres=# \c newdb; warning: console code page (437) differs windows code page (1252) 8-bit characters might not work correctly. see psql reference page "notes windows users" details. connected database "newdb" user "postgres". newdb=# disconnect newdb; error: syntax error @ or near "disconnect" line 1: disconnect newdb; ^ newdb=# it isnt working there other way or wrong in anything!! it's easy, example. --my databases postgres=# ...

Marathi Font Support for EditText in Android -

i want give input in marathi language instead of english. have done setting textview in marathi. possible in android give input in marathi language? if yes please tell me how in android. thank in advance. final typeface customf = typeface.createfromasset(this.getasset(), "urttf.ttf"); final textview textv = (textview) findviewbyid(...); textview.settypeface(customf);

extjs - Combobox - Auto position in dropdown list -

Image
i have simple combobox follows : { xtype: 'combobox', id: 'prd-main-group', fieldlabel: 'ana mal grubu', inputwidth: 320, labelwidth: 160, labelalign: 'right', margin: '15 0 0 0', fieldstyle: 'height: 26px; text-align: right; font-size: 12pt; color:#505050', store: articlemain, valuefield: 'whg', displayfield: 'whg_bez', querymode: 'remote', autoselect: false, selectonfocus: true, hidetrigger: true, msgtarget: 'side', triggeraction: 'all', typeahead: true, minchars: 2, listeners:...

asp.net - Check if Email Address Belongs to Yahoo? -

private byte[] bytesfromstring(string str) { return encoding.ascii.getbytes(str); } private int getresponsecode(string responsestring) { return int.parse(responsestring.substring(0, 3)); } protected void button1_click(object sender, eventargs e) { tcpclient tclient = new tcpclient("plus.smtp.mail.yahoo.com", 465); string crlf = "\r\n"; byte[] databuffer; string responsestring; networkstream netstream = tclient.getstream(); streamreader reader = new streamreader(netstream); responsestring = reader.readline(); databuffer = bytesfromstring("helo " + crlf); netstream.write(databuffer, 0, databuffer.length); responsestring = reader.readline(); databuffer = bytesfromstring("mail from:<myemail@yahoo.com>" + crlf); netstream.write(databuffer, 0, databuffer.length); responsestring = reader.readline()...

api - Has Facebook's sharer.php been undeprecated? -

as many questions on website show, there used talk facebook's sharer.php, link use let people share content, being deprecated . however, there is, once more, documentation on how use it , time named share dialog. mean no longer deprecated?

asp.net mvc - JQueryValidation with MVC 4 not validating on blur -

i beating head on wall hours mvc 4 , jquery validation validate first first on blur. have tried attaching validation entire form , individual element (first field) no avail. if add alert() blur event seems fire no validation of required field. have additional validations add after required working haven't gotten them yet. don't know problem mvc 4. jqueryvalidate v1.10. have tried setting validator , calling .valid() on element want validated using .blur , still not validation can see. $(function () { $('#productionorder').focus(); $.validator.addmethod("cminlength", $.validator.methods.minlength, $.format("must contain least {0} chars")); $.validator.addclassrules("productionorder", { cmnlength: 3 }); $('#myform').validate({ onkeyup: false, //onfocusout: false, errorclass: 'fielderror' //rules: { // productionorder: "required number", ...

html - Large inline SVG doesn't get fully drawn -

i'm having svg file that's around 6300 lines long. opening file .svg in chrome works fine. use inline in html file via <object> tag half elements drawn. with chrome's "analyze element" option see, source embedded svg cut off. i tried firefox, here svg empty before, difference, missing elements drawn underneath in strange positions . if open svg external data via <object data=""> works fine, not viable option, since scripts not working way. because svg contains confidential data can't link here. hope can me. are sure there not parsing problem file happening when inlined? svg renderers stop rendering when encounter problem. i start trying locate element stops at. oddities.

javascript - How to get element by class name? -

this question has answer here: how element class in javascript? 11 answers using javascript, can element id using following syntax: var x=document.getelementbyid("by_id"); i tried following element class: var y=document.getelementbyclass("by_class"); but resulted error: getelementbyclass not function how can element class? the name of dom function getelementsbyclassname , not getelementbyclassname , because more 1 element on page can have same class, hence: elements . the return value of nodelist instance, or superset of nodelist (ff, instance returns instance of htmlcollection ). @ rate: return value array-like object: var y = document.getelementsbyclassname('foo'); var anode = y[0]; if, reason need return object array, can easily, because of magic length property: var arrfromlist = array.prototype.slice.cal...

android - Geocoder getFromLocation() not null but has size 0 always -

i trying retrieve location address using google api v2. here do: geocoder geocoder = new geocoder(this, locale.getdefault()); list<address> addresses = null; string addresstext = ""; try { while (addresses==null){ addresses = geocoder.getfromlocation(userlocation.latitude, userlocation.longitude, 1); } if (addresses != null && addresses.size() > 0) { address address = addresses.get(0); addresstext = string.format( "%s, %s, %s", address.getmaxaddresslineindex() > 0 ? address .getaddressline(0) : "", address .getlocality(), address.getcountryname()); } } catch (ioexception e) { e.printstacktr...

c# - Result of two multipled columns in a datagridview row -

i have got code calculates summary of 2 multiplied columns of rows in datagridview , shows result in textbox . i have got third column called sum in show particular result of each row. i'm sorry because have no idea how can that, haven't tried yet. may please show me way? thanks time,comments or answers. private void vypocti_odvody(int price, int vat, int tot_rows2) { try { double outval = 0; foreach (datagridviewrow row in datagridview1.rows) { outval = outval + (convert.todouble(row.cells[price].value)/100) * convert.todouble(row.cells[vat].value) + (convert.todouble(row.cells[price].value)); } // s_ub_celk.text = (((a / 100) * b) + a).tostring(); convert.todecimal ( result.text = outval.tostring()) ; } catch (exception ex) { messagebox.show("chybové hlášení k3 " + ex.message.tostring()); } } you can give value column assigning it's v...

Call a private method using a String in VB.Net -

ok have class this. namespace myspace public class classa private function methoda(prm boolean) boolean return false end function private function methodb() boolean return false end function end class public class classb private function methodc() boolean return true end function private function invokea() boolean dim methodobj methodinfo 'null pointer except below here methodobj = type.gettype("myspace.classa").getmethod("methoda") dim params boolean() = {false} return cbool(methodobj.invoke(new classa(), params)) end function end class end namespace what trying here invoke method different class parameters using method. returns null pointer exception. why? went wrong? you doing various things wrong. following code should work without problem: dim obja classa = new classa() methodobj = obja.gettype().getmethod("methoda...

python - Finding the difference when substracting two dictionaries in both ways in one operation -

i have code: new = {'a': 1, 'b': 2} old = {'a': 1, 'c': 3} added = new.keys() - old.keys() if added: print('{} keys have been added'.format(len(added))) removed = old.keys() - new.keys() if removed: print('{} keys have been removed'.format(len(removed))) # added, removed = minus_dict(new, old) i have subtraction operation twice. minus_dict function exist? mean how find added , removed in more efficient way? use xor operator if single set suffices: >>> old.keys() ^ new.keys() {'c', 'b'} if that's not enough, have 2 subtractions, or code algorithm yourself.

c# - How to get notified of changes in an RSS feed -

i need populate database data rss feed. there anyway ensure don't populate database duplicate information? i don't want compare data in database determine if have duplicate information thi slow. similar question how detect changed , new items in rss feed? answer not looking for. you want use guid-element of item perform duplicate-checks. if know guid of item, seen you.

Create a vector in a matrix using data from a dataframe conditioned to variable values in the matrix in R -

this bit hard explain in writing, i'll best. (this first post here). so, have dataframe " x " this: +---+----+----+-----+ | | | b | c | | 1 | 50 | 40 | 30 | | 2 | 60 | 80 | 40 | | 3 | 70 | 30 | 20 | | 4 | 10 | 40 | 100 | | 5 | 35 | 50 | 20 | | 6 | 20 | 50 | 30 | +---+----+----+-----+ and matrix " y " this: +---+---+---+---+---+---+ | | c | c | b | | | | 1 | 5 | 5 | 4 | 3 | 6 | +---+---+---+---+---+---+ (assume letters numbers, use letters explain more clearly). want 'r' create new row in " y " matrix extracting data " x " dataframe depending on values of first , second row of matrix. so, example, third column in matrix " y ", extracted value dataframe 20. since on first row value "c" , on second row value "5" , in dataframe value "c" , "5" intersect 20. so, need 'r' use data in first , second row matrix , go dataframe , check first row , column each value...

ios - Sandbox "Apple ID Password" login alerts forever -

i keep on getting "apple id password" login alerts 2 of app store test accounts. appear time after reconnecting internet; seems bit random. not appear time or immediately, when run app. when run app (the one, can't other apps), none of code getting called. neither call ios methods may cause these alerts appear. what can stop getting these alerts? this can happen if make multiple receipt refresh requests using refreshrequest = [[skreceiptrefreshrequest alloc] init]; [refreshrequest start];

javascript - Drawing rectangles with Jquery -

i have div called #llens need draw boxes ( div's). can't understand why not drawing. i'm litle newbie please patient if i'm make great mistakes :p that's div : <div id="estructura" class="collapse "> <section data-toggle="buttons-radio" class="btn-group btn-group-vertical"> <header id="professor" class="btn btn-primary boto_funcio "> <h2>professors</h2> </header> <header id="alumne" class="btn btn-primary boto_funcio "> <h2>alumnes </h2> </header> <header id="text" class="btn btn-primary boto_funcio "> <h2>text </h2> </header> </section> </div> <section class="span9"> <div id="llens"></div> <!-- llens --> <...

php - jqplot graphs are displayed on top of one another -

i have form user fills in show report , when submitted report shows table whatever values database , each table has graph below it. so problem when report contains many tables, graphs on top of each other after first table, , can see last graph want each graph after table. it worked perfect when using phplot don't know problem here. added word 'graph' between div tags test so: <div id="chart1">graph</div> and word 'graph' after each table actual graphs stuck in 1 place. any idea how fix this? here's code making graphs: < script type = "text/javascript" > $(document).ready(function () { var line1 = < ? php echo json_encode($data, json_numeric_check); ? > var plot1 = $.jqplot('chart1', [line1], { title : 'daily usage <?php echo $datestart;?> <?php echo $dateend;?>', axesdefaults : ...

Program for Backup - Python -

im trying execute following code in python 2.7 on windows7. purpose of code take specified folder specified folder per naming pattern given. however, im not able work. output has been 'backup failed'. please advise on how resolve code working. thanks. code : backup_ver1.py import os import time import sys sys.path.append('c:\python27\gnuwin32\bin') source = 'c:\new' target_dir = 'e:\backup' target = target_dir + os.sep + time.strftime('%y%m%d%h%m%s') + '.zip' zip_command = "zip -qr {0} {1}".format(target,''.join(source)) print('this program backing files') print(zip_command) if os.system(zip_command)==0: print('successful backup to', target) else: print('backup failed') see if escaping \'s helps :- source = 'c:\\new' target_dir = 'e:\\backup'

python - how to overlay svg vector graphic over backgroud raster -

does knows how overlay svg vector graphic on backgroud raster (png) ? preferably in python. i've tried cairo , rsvg i'm getting black bacground after converting svg png. img = cairo.imagesurface(cairo.format_rgb24, width, height) ctx = cairo.context(img) print 'svg', tmp_svg handler = rsvg.handle(none, str(svg_data)) handler.render_cairo(ctx) img.write_to_png('/tmp/test.png') after converting svg png overlay 2 png files python pil image.blend(background, overlay, 0.5 ) maybe there simple solution overlaying directly background svg (without svg png)? greets. is image determined @ runtime, or beforehand? if latter, add <image> element svg points background image.

Calculating Percentage within a MYSQL Group -

my query calculates total numbers of calls within sla priority. need work out percentage of calls within sla priority within same statement however unsure how within current statement `select sum(o.withinfix) 'total' ,o.priority 'priority' opencall o left(from_unixtime(o.logdatex),4) = "2013" , o.fk_company_id = "abc" group o.priority' can help, using mysql 5.1 thanks select sum(o.withinfix) 'total', sum(o.withinfix) / (select sum(withinfix) opencall) * 100 perc o.priority 'priority' opencall o left(from_unixtime(o.logdatex),4) = "2013" , o.fk_company_id = "abc" group o.priority

asp.net - WebResource.axd A script on this page may be busy -

i'm getting error when open aspx page in firefox having java script files. a script on page may busy, or may have stopped responding. can stop script now, or can continue see if script complete. script: http://:3370/webresource.axd?d=sqklils3i83rlyfbm7crljgndcw8tybuunzdse8da_w1ienfv8m0bzyf-yurpwel7spxyn_qpwffarvuywux8zrsocc-rmzpejapiql501tdyfoqwx1xbd8kspfe3dbh7fcctph0qha7o2ifwhfh3ham2ghcy-tlxkt0o5emuu8rscgj0&t=635031027038792083:20

operating system - How to get OS level information using Java? -

i looking method or package in java can os level information. is there package equivalent management object searcher(c#) in java? if know os native library need information desire call using jni .

bash - How to print a script's source in unix? -

i have custom script in 1 of $path folders. know plaintext python script , not compiled binary. there way print source? i have tried whereis <scriptname> , doesn't return anything. $>ls -lrt `echo $path | sed "s/:/\n /g"` | grep <scriptname> lrwxrwxrwx 1 root eng 30 oct 16 2011 <scriptname> -> ../depot/dcs-scripts/bin/<scriptname> what ../ mean in ../depot/dcs-scripts/bin/<scriptname> ? cat `which scriptname` usually trick

Linux CentOs Restart Services -

i have applications running on remote centos server. i'd want them restart in case of unexpected server failures or shutdown or application crashes. suggestions on how achieve ? just make them "respawn" in inittab. init can maintain processes running. set process need continually run have action field type of "respawn". see here .

console - Rails deleting record in join table -

i have 2 associated tables, 'releases' & 'tracks' contain fields 'name' , 'isrc' respectively. i trying remove tracks database when release.name equal value, e.g "thriller". the relationship here 'track' belongs_to 'release' , 'release' has_many 'tracks'. can me how achieve within rails console? in release model: has_many :tracks, dependent: :destroy this remove tracks associated release database when destroy release. you can test doing in console release = realse.where(name:"thriller").first release_id = release.id release.destroy tracks = track.where(release_id:release_id) the variable tracks should empty.

What are the square brackets in ASP.NET means (C#) ex. Session[""];? -

i beginner in asp.net , experienced c# programmer can't understand role of square brackets in asp.net. for example, ran things: session["masterpage"] , viewstate["masterpage"] , application["users"] etc. array or indxers? sorry, can't understand it. thanks helpers :) session , application both storage objects indexer property . seeing use of property. string myname = (string) session["name"]; can thought of use of hypothetical function: string myname = (string) session.getvalueforkey("name"); the property offers more compact , familiar (array-like) notation.

IOS UITableview in Storyboard cell's elements frame size and height shows zero -

i creating tableview , creating cells follows static nsstring *cellidentifier = @"raffel"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; uiview *imv=(uiview*)[cell viewwithtag:100]; uilabel *title=(uilabel*)[cell viewwithtag:101]; uitextview *ticketdetails=(uitextview*)[cell viewwithtag:102]; uilabel *bdprice=(uilabel*)[cell viewwithtag:103]; uilabel *usdprice=(uilabel*)[cell viewwithtag:104]; uilabel *tickrema=(uilabel*)[cell viewwithtag:105]; nslog(@"fram %@",imv); and log shows fram <uiview: 0x1ed91bd0; frame = (0 171; 0 0); autoresize = tm+bm; tag = 100; layer = <calayer: 0x1ed91c30>> it shows 0 height , width actuall height*width 100*100 implement this method in code.. - (cgfloat) tableview: (uitableview *) tableview heightforrowatindexpath: (nsindexpath *) indexpath { return 100; }

How to build a dynamic MySQL INSERT statement with PHP -

hello part of form showing columns names mysql table (names of applications installed on computer) , creating form yes/no option or input type="text" box additional privileges application.. how can insert mysql table using post , mysql_query insert into????? quantity of columns changing because there form adding applications with/without privileges.. <tr bgcolor=#ddddff>'; //mysql_query getting columns names $result = mysql_query("show columns employees") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { //exclude these columns bcs these in other part of form if($row[0] == 'id' || $row[0] == 'nameandsurname' || $row[0] == 'department' || $row[0] == 'phone' || $row[0] == 'computer' || $row[0] == 'data') continue; echo '<td bgcolor=#ddddff>'.$row[0].'<br />'; if (stripos($row[0], "privileges") !== false...

c# - How can I get conditional data with LINQ -

i have list called stacoverflows includes 1 item such isok, number. stackoverflows [0] -- isok = false; [0] -- number = 5768; [1] -- isok = true; [1] -- number = 4348; how can number value (if there isok = true) isok = true linq? should use any ? yourcollection.where(i => i.isok).select(i => i.number).tolist()

html - Css: Mysterious margin -

does know why mysterious margin is? this link site i have tried everything! turning margins off , on , playing padding cant find problem why horizontal slider bar appear? thanks help! you have pretty significant typo in your css : body{ marign: 0px; background-color: #e6e6e6; width: 100%; height: 100%; } margin spelled incorrectly. to eliminate odd margins arise, suggest adding code: body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; } usually pretty safe bet eliminates unnecessary margins, , fixes problem. have margins on place, post it's hard us understand which margins trying eliminate.

visual c++ - Array allocation in C++ on stack with varying length -

this question has answer here: c++: why int array[size] work? 3 answers i surprised find out possible allocate varying-length array on stack in c++ (such int array[i]; ). seems work fine on both clang , gcc (on os/x) msvc 2012 don't allow it. what language feature called? , official c++ language feature? if yes, version of c++? full example: #include <iostream> using namespace std; int sum(int *array, int length){ int s = 0; (int i=0;i<length;i++){ s+= array[i]; } return s; } int func(int i){ int array[i]; // <-- feature i'm talking (int j=0;j<i;j++){ array[j] = j; } return sum(array, i); } int main(int argc, const char * argv[]) { cout << "func 1 "<<func(1)<<endl; cout << "func 2 "<<func(2)<<endl; cout << ...

Python - read from file skip lines starts with # -

try read file , make dictionary lines, skippipng lines starts # symbol file example: param1=val1 # here comment my function: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li=line.lstrip() if not li.startswith("#"): config[line.split('=')[0]] = line.split('=')[1].strip() return config i list index out of range error but! if try skip lines starts with, example, symbol "h" - function works well... try with: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li = line.lstrip() if not li.startswith("#") , '=' in li: key, value = line.split('=', 1) config[key] = value.strip() return config you maybe have blank line breaks split()

MYSQL datetime to mongoDB -

i have converted mysql db mongodb. one field, publish_datetime mysql datetime field. in mongo, need todo ordering datetime field. is possible without converting seperate field timestamp? it not matter type is, sorting either datetime value or integer value happens with: db.collection.find().sort( { field_name: 1 } ); however, helpful if showed sample document has "datetime" value in there.

onclick - VBA - populate cell from different sheet on mouse click -

the problem facing is, require cell autopopulate cell reference in different sheet within same workbook when user clicks cell. e.g. 1) user clicks a1 on sheet 1 2) cell a2 on sheet 1 populates value cell a1 in sheet 2 i need function span approximatly 80+ references, in other words have list of on 80 project names in sheet 1 a1= projectname 1 a2= projectname2 , on. sheet 2 has of project descriptions...a1 project1 descroption..a2 project2 description , on. i believe looking worksheet_selectionchange event. in sheet selecting add following: private sub worksheet_selectionchange(byval target range) if target.column = 1 ... end if end sub this method gets called anytime select new cell.

php - How to find storage location of images in tiny mice -

i'm in process of migrating data k-ecommerce platform magento ecommerce platform. stuck getting product images k-ecommerce platform. in backend, using tiny mce editor upload images , direct uploads there. find of product images in shown image folder. others not found. suspect, 'shown images' direct upload images , 'not found images' uploaded through tiny mce editor. tiny mce store images in database? can give me clue find images uploaded through tiny mce editor. 'filesystem.rootpath' configuration in config.php sets upload folder edit image path of in tiny mce popup this. again suspect data database. ../../stream/index.php?cmd=im.streamfile&path={0}/product_folder/image_name.jpg thanks. well, not familiar tinymce uploadmanager, think images stored here: tiny_mce/plugins/imagemanager/files/

html - Make a Menu div spread in the middle and work in smaller screens -

i'm building website client, , 1 of last problems can't solve menu issue. believe might helpful other people. the menu has 3 div s inside (the parent div ) . here code, bit shortened: <div id="header"> <div id="logo"><img src='logo.png' /></div> <div id='languageselect'>language select</div> <div id="menu"> <ul id="menu_noya"> <li class="head_item"> <a href="index.php?page=women">{$language["menuwomen"]}</a> <ul> <li><span style='color:#352618;font-family:tahoma;font-size:11px;font-weight:bold;'>{$language["inmenuwomen"]}</span></li> <li><a href='index.php?page=women'><img src='/styles/images/women1.jpeg' style='height:170px;width:120px;...

asp.net - Getting Error while adding new MVC 4 Project -

Image
i new mvc. have installed nuget extension when had installed mvc 4. after had run cleaner because of think temp files have been deleted. when trying add new mvc 4 project shows me following error : i have uninstalled nuget still facing same problem, please me how can come out of this. for reason, nuget package manager not installed default. came across problem few times already. what want this. first : need unistall npm(nuget package manager) , did already, can try again, sure :) visual studio -> tools -> extensions , updates -> npm -> unistall second : after unistall npm, need install again use (ofc). there several ways install npm: 1) install under visual studio -> tools -> extenstions , updates> npm -> install 2) goto http://nuget.org , search install nuget link , click on it, downlaod .vsix file , install in on visual studio third : after installation, close , re-open visual studio, never error again.

excel - Find a specific value, first appearance and display the value -

i need seems simple problem. in excel file, want search first appearance of value in column , produce occurs at. in column a, have listing of numbers (the x-axis) , in column f, have series of data. want find first appearance of value in column f greater 7.5 , place it's relative column value in cell. both columns , f run cells 1 4000. if possible vba function or simple input function great help! with quite lot of guessing, may suit: =index(a:a,match(7.5,f:f,1)+1,1) edit guessed wrong.

Custom modal screen in TinyMCE 4 plugin in inline mode -

i developing custom plugin new tinymce 4. plugin utilizes modal screen. because want use modal screen/js service developed chose not use tinymce's window manager . the problem tinymce looses focus open open modal screen. want tinymce keep toolbars opened, because otherwise cannot interact editor. tinymce closes because receives blur event (and because not know opened windows). an minified problem showing problem can found in following fiddle. problem occurs example button clicked. http://fiddle.tinymce.com/pudaab/1 the shortened code attached below: tinymce.pluginmanager.add('example', function(editor, url) { // add button opens window editor.addbutton('example', { text: 'my button', icon: false, onclick: function() { var selection = editor.selection, dom = editor.dom, selectedelm, anchorelm; // focus editor since selection lost on webkit in ...

upgrade cassandra 1.1.2 -> 1.1.12 without LeveledCompactionStrategy -

i use cassandra 1.1.2 , upgrade 1.1.12. sstables not have leveledcompactionstrategy specified. following http://www.datastax.com/docs/1.1/install/upgrading#sstable-scrub not clear me if have scrub or if can proceed points 6 , 7 of http://www.datastax.com/docs/1.1/install/upgrading#completing-upgrade . clarify procedure? thank in advance. kind regards, silvio no special actions needed; drop new jar in , restart.

php - Why Response::download() won't download anything except PDF in Laravel 4? -

this line of code giving me sick. return response::download(storage_path().'/file/' . $file->id . "." . $file->file->extension); the files uploaded , given id saved under e.g. 25.pdf works fine if file pdf doesn't else e.g. png. upgraded laravel 3 4 try overcome problem. any ideas? edit: uploaded test text file word test in once uploaded , downloaded opened it, there 3 blank lines , letters te!!!!!i downloaded through sftp , file correctly stored on server defiantly download procedure! i used function instead of of laravel stuff. :/ (stolen other places around web) public static function big_download($path, $name = null, array $headers = array()) { if (is_null($name)) $name = basename($path); $finfo = finfo_open(fileinfo_mime_type); $pathparts = pathinfo($path); // prepare headers $headers = array_merge(array( 'content-description' => 'file transfer', 'content-typ...

sql - Count issue when introducing a new column -

fairly new sql. i'm trying count total number of booking id's in query holidays in 2 regions. this want need.. id count region name 427139 1 france 427776 2 spain 427776 2 france but seem deliver this.. id count region name 427139 1 france 427776 1 spain 427776 1 france bookings id's unique split 2 rows when introduce region region table (via quotes , properties tables.) here's sql.. select count(bo.id) count, bo.id 'booking id', re.name 'region name' booking bo (nolock) left join quote qu (nolock) on qu.id = bo.quoteid left join property pr (nolock) on pr.code = qu.code left join region re (nolock) on re.id = pr.regionid bo.id = '427776' or bo.id = '427139' group bo.id,re.name order bo.id can help? thanks looking! in sqlserver2005+ can use over() clause aggregate function count() select count(*) over(partition bo.id) ...

android emulator - Running Instagram on AVD -

i wanted use instagram on computer, decided use android virtual device task. i downloaded android sdk , newest apk instagram computer. then created new avd , ran it. after booted, installed instagram apk using adb install instagram.apk . it installed smoothly , after clicking app, started . now here's problem : there on nothing works. when try login , press login button, nothing happens there no internet connection. browsers , other apps using internet connection work fine, instagram doesn't work. how can fix this? i think has android emulator can't handle global proxy. therefore hostnames resolved directly ip violates http 1.1 standarts , request doesn't send properly. fix this, needed change hostname gets send instead of ip.

android - Fatal Exception during scrolling a ListView -

the app runs fine until scroll few times in listview. this error got logcat. code custom baseadapter used below it. 07-31 10:08:43.550: e/androidruntime(32570): fatal exception: main 07-31 10:08:43.550: e/androidruntime(32570): java.lang.nullpointerexception 07-31 10:08:43.550: e/androidruntime(32570): @ com.duobility.leathr.homescreen$timelineadapter.getview(homescreen.java:485) 07-31 10:08:43.550: e/androidruntime(32570): @ com.haarman.listviewanimations.baseadapterdecorator.getview(baseadapterdecorator.java:87) 07-31 10:08:43.550: e/androidruntime(32570): @ com.haarman.listviewanimations.swinginadapters.animationadapter.getview(animationadapter.java:94) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.abslistview.obtainview(abslistview.java:2452) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.listview.makeandaddview(listview.java:1775) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.listview.filldown(listview.java:6...

wpf - Running cmd command from vb.net issue -

i trying run following code in click event. because executes command in cmd shell, don't know why wont run. can open cmd.exe administrator commenting out arguments. stick these arguments in .bat file, running process.start. however, why cant run shell arguments? i'd prefer method on putting arguments in .bat file. dim process new system.diagnostics.process() dim startinfo new system.diagnostics.processstartinfo() ' startinfo.windowstyle = system.diagnostics.processwindowstyle.hidden startinfo.filename = "cmd.exe" if system.environment.osversion.version.major >= 6 ' windows vista or higher startinfo.verb = "runas" else ' no need prompt run admin end if startinfo.arguments = "/c bcdedit /set {current} safeboot network" process.startinfo = startinfo process.start() figured out. had copy bcdedit.exe project. had thought c...

javascript - XPages - trigger validation before executing CSJS? -

i have button executes csjs before doing trigger document validation. validate document before saving using ssjs , display errors control. validation works fine when press "save" button triggers save document simple action. possible trigger validation before executing csjs? there few options. you put csjs in oncomplete event of button's eventhandler (you need go properties of eventhandler, not properties of button find oncomplete). you call csjs via ssjs method view.postscript("mycsjsfunction()") . if use csjs tab button, trigger before submission server-side processing. it's designed client-side checking occur , prevent server-side, e.g. using return confirm("are sure?") check whether user wants cancel out of document or delete document etc.