Posts

Showing posts from January, 2011

java - How to format my date with SimpleDateFormat? -

i'm trying set date format, when run code string oldstring = "2013-01-1"; system.out.println("oldstring = "+oldstring); date date = new simpledateformat("yyyy-mm-dd").parse(oldstring); system.out.println("datefield = "+date); i take result: oldstring = 2013-01-1 datefield = tue jan 01 00:01:00 msk 2013 why datefield isn't equal 2013-01-1? the type of datefield date, tostring method return same format, not overriding it. so need do, basically: string oldstring = "2013-01-1"; system.out.println("oldstring = "+oldstring); simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); date date = sdf.parse(oldstring); system.out.println("datefield = "+date); string outdatestr = sdf.format(date); system.out.println("newstring = "+outdatestr);

javascript - Why is my !important style attribute getting overwritten in Chrome? -

Image
this question has answer here: jquery - apply css style elements within specifed div? 6 answers i writing chrome extension. , need elements relative. added position: relative !important; body 's style make of them relative. in page testing there js sets elements' values position: fixed . thought important attribute has priority in css, somehow element still fixed , not relative. here getting in chrome inspect: (notice position: fixed @ styles' top , position: relative !important @ bottom). , element still fixed. if uncheck position: fixed rule inside chrome inspect, become relative, yeah, that's want do, want js make (actually, of elements) relative. is there way accomplish this? maybe question related this: why isn't !important attribute working in google chrome? , i'm not sure. to apply style elements (which seems wron

azure - Exceeding Quota For "Database Units - Web Edition" -

i have azure subscription , exceeding quota of "1 db unit" "database units - web edition". i not @ sure means. have mobile service, blob storage, web site, , 5 sql databases setup. classified "database unit" , "1 db unit"? because windows azure billing team has decided introduce incremental pricing strategy sql database, tremendously reducing original price, introduced term "database unit". speaking of "exceeding quota" suspect using msdn [pro|premium|ultimate] subscription benefits. stated quite database unit on page these benefits detailed : ... offer includes 1du web edition sql database (1du=1gb) use services deploy subscription, ... which on official pricing details page displayed as: database units (du) appear on bill

Designing a general slide window program in Haskell, need type class family? -

i trying implement general sliding window algorithm on list of elements. common use case find largest number in windows of length 5. or can count how many elements in window true predicate. the sliding window going left right, , maintain data structure. element fall outside window calls remove on data structure. if new element falls within window, add element data structure. has function aggregate , compute on data structure. the naive data structure use dequeue, it's potentially possible want use other kind of data structure special use cases. my original idea have long function looks this runslidingwindow :: (c->(int,a)->c) -- add -> (c->(int,a)->c) -- remove -> (c->b) -- aggregate -> c -- identity -> int -- width -> [(int,a)] -- input -> [(int,b)] but wondering there haskell way can d

java - ArrayList of type Object to display output in JTextArea -

i have assignment i'm working in college, have gui asking input user , display final output (an arraylist of type object) in jtextarea, in separate classes. problem it's displaying return tostring() method overwritten. here's code, tostring method in non gui class: @override public string tostring() { int u = 1; system.out.println("team " + name + " has " + players.size() + " players"); for(int i=0; i< players.size();i++) { system.out.print(u++ + "."); system.out.println(players.get(i)); } return "team " + name + " has " + size + " players"; } } this jtextarea calling gui class: public class gui extends team { //buttons /constructor public gui() { frame = new jframe("team manager"); frame.setlayout(new borderlayout());

JMS MQ connection pooling in WAS 7 -

we using jms communicate websphere mq [v7] using websphere application server [v7]. application heavy load of around 4-5 tps. use connection factory along sender , receive queue implement synchronous mq operation. currently, connection factory has been defined static , queues obtained through jndi lookup each request. from performance perspective need explicitly implement connection pool such apache commons pool or connection pooling offered suffice? the jms settings have been configured in based on expected load.

linq - The type or namespace name 'var' could not be found in asp.net 2.0 -

i using asp.net 2.0.i trying built application on how build store locator asp.net application using google maps api .when trying use "var" in pplication giving error "the type or namespace name 'var' not found (are missing using directive or assembly reference?)". i have downloaded above article , working correctly in vs2005.i wonder why error comes in project ?? namespace have used in application using system; using system.collections.generic; using system.web; using system.xml.linq; using system.linq; heres class have used public static xelement getgeocodingsearchresults(string address) { // use google geocoding service information user-entered address // see http://code.google.com/apis/maps/documentation/geocoding/index.html more info... var url = string.format("http://maps.google.com/maps/api/geocode/xml?address={0}&sensor=false", httpcontext.current.server.urlencode(address)); // load xml xelement object (wh

c++ - Keeping accuracy when taking decimal to power of integer -

my code follows (i have simplified ease of reading, sorry lack of functions): #include <stdio.h> #include <string.h> #include <math.h> #include <iostream> #include <iomanip> #include <fstream> #include <time.h> #include <stdlib.h> #include <sstream> #include <gmpxx.h> using namespace std; #define pi 3.14159265358979323846 int main() { int a,b,c,d,f,i,j,k,m,n,s,t,success,fails; double p,theta,phi,time,averagetime,energy,energy,distance,length,dotprodforce, forcemagnitude,forcemagnitude[201],force[201][4],e[1000001],en[501],epsilon[4],ep, x[201][4],new_x[201][4],y[201][4],a[201],alpha[201][201],degree,bestalpha[501]; clock_t t1,t2; t1=clock(); t=1; /* set parameter t, power in energy function */ while(t<1001){ n=2; /*set parameter n, number of points going onto sphere */ while(n<51){ cout << "n=" << n << "\n"; b=0; time=0.0; /* set par

php - can i merge those 2 queries in one query -

hello can merge 2 queries in 1 query first query number of articles in database , second query sum of visits of article whats best method make 1 query $stmt = $db->query('select * stories'); $story_count = $stmt->rowcount(); $stmt = $db->query("select sum(visits) stories"); $total_visits = $stmt->fetchcolumn(); try like $stmt = $db->query('select count(*) total_cnt, sum(visits) total_visits stories'); then excute query,you result "total_cnt" , "total_visits"

reactjs - How to retrieve a react element from a dom element -

the question here not is idea or not , because there real use-case : i'm scraping specific website headless browser internal service , need extract data react. from active production application, retrieve props root component using "pure" javascript. thing got div right now. the constraints are: it must done using pure javascript (or using standard react lib) i cannot add/setup react-devtools extensions or things that so far hack event handler trigger manage enter react context i'm looking cleaner alternatives, ideas?

mysql - Hibernate Inheritance - Structure referring to Superclass -

i want create structure manage products in mysql using hibernate 4.1. in general there 2 kind of products: simpleproduct (contains description , price) , complexproduct (contains list containing products again). so created abstact class product , derived classes simpleproduct , complexproduct. thought table_per_class inheritancetype convenient. product.java @entity @inheritance(strategy=inheritancetype.table_per_class) public abstract class product { private long id; private string description; private bigdecimal price; private product parent; protected product() { } protected product(string description, bigdecimal price) { this.description = description; this.price = price; } @id @generatedvalue(strategy = generationtype.table) @column(name="id") public long getid() { return id; } public void setid(long id) { this.id = id; } @column(name="description"

React Native ListView get visible rows -

i'm building chat app. need ability mark messages viewed in list view , user sees read. how can find out row visible user? after research, i've found rn-component can information component's visibility. https://github.com/yamill/react-native-inviewport

python - Retrieve and validate x509 certificate chain -

i trying determine best way retrieve , validate chain of x509 certificates in python. if certificates in chain invalid, need able identify 1 , reason (like openssl verify @ command line). newer versions of python ssl module seem offer functionality, i'm not version available code run. i have done best researching similar question on here, specifically how verify ssl certificate in python? validate ssl certificates python how use m2crypto validate x509 certificate chain in non-ssl setting however i'm still not clear on best way go it. is possible achieve functionality (isolating single invalid certificate) using builtin ssl module, or need use m2crypto? if neither of these appropriate, subprocess module call out openssl alternative solution?

c++ - SDL Mouse Click -

so, i'm working on options menu game, have button when pressed changes it's text next resolution in array, user presses button change resolution next string in array. my problem getting click event. right now, when user presses button, returns true while mouse down, instead of when mouse pressed. want return true in mouse event when mouse pressed. i've looked around, , i've found seems similar i've done or, said, returning true while mouse down, instead of initial click. my events handled in eventmanager singleton, , here functions see necessary: my update function, event polled, worth noting i'm using private sdl_event named "e". void eventmanager::update(){ while(sdl_pollevent(&e)){ sdl_getmousestate(&mousex, &mousey); switch(e.type){ case sdl_quit: running = false; } } } my mousepress function, want mouse press returned. int eventmanager::mousepress(){ i

c# - Json Deserialization can't access attributes of object -

i got class (by using json2c#): public class friends { public class datum { public string name { get; set; } public string id { get; set; } } public class paging { public string next { get; set; } } public class summary { public int total_count { get; set; } } public class rootobject { public list<datum> data { get; set; } public paging paging { get; set; } public summary summary { get; set; } } } and poor try perfom deserialization: datacontractjsonserializer js = new datacontractjsonserializer(typeof(friends)); memorystream ms = new memorystream(system.text.asciiencoding.ascii.getbytes(data)); friends x = (friends)js.readobject(ms); i thought should able access example friends.datum.name not work. my question is, did wrong? how should optimise code? i got datatemplate listview , i'm using mvvm pattern, b

android - Trouble In displaying an image -

i doing program in taking photos using camera storing in private folder.from fetching images , displaying in grid view.on clicking grid view showing fullscreen image. trouble facing when camera in portrait mode image quality perfect.but if camera in landscape mode showing streched image how can overcome this. hi have @ below code. before saving captured image following process. save images in portrait mode. hope you. int rotation = -1; rotation = ((windowmanager)getsystemservice(context.window_service)) .getdefaultdisplay().getorientation(); matrix rotator = new matrix(); switch (rotation) { case (surface.rotation_0): break; case (surface.rotation_90): rotator.postrotate(270); break; case (surface.rotation_180): rotator.postrotate(180); break; case (surface.rotation_270): rotator.postrotate(90); break; // screen_{width,height} applied before rotate, don't /

java - Parsing PDF file using Apache PDFBox -

i trying modify contents of pdf document using pdfbox . used this example is, observed text pdf file getting split @ character level (or worse). example, string, em? is: gets split into: cosstring{e} cosstring{m?} cosstring{ } cosstring{w} cosstring{hat } cosstring{it } cosstring{is} cosstring{:} (when checked printing cosstring in above mentioned code). far can see, there latin characters in file, , encoding iso-8859-1. ideas? regards, salil this pdf formatting issue. how particular pdf stores text in order correct letter spacing or kerning . varies pdf pdf, depending on how created. typically, suggest merging different tokens 1 big content string.

javascript - Chrome Extension for looking string -

need bit make chrome extension looks string x source , creates popup if x has been found. string containing source of document: document.documentelement.outerhtml check if contains x : document.documentelement.outerhtml.indexof(x) !== -1; happy coding!

python - How can I edit PYTHONPATH on a Mac? -

how can permanently change pythonpath on mac? i've tried editing .bash_profile, when use print sys.path in file gives huge list of different urls .bash_profile. in terminal when type echo $pythonpath shows blank line. don't want use sys.path.append('...') because have put in every file. you can append path $path , not $pythonpath . if insist change pythonpath , in context prefferable: do this : export pythonpath=$pythonpath:/users/username/pymodules to make sure following convention of append pythonpath see what should set in pythonpath? .

PHP - avconv create thumbnail wrong rotation -

in server using avconv library in order generate thumbnails videos. call works fine except image generated got rotated 90 degrees. here call: shell_exec("avconv -itsoffset -4 -i $video -vcodec mjpeg -vframes 1 -an -f rawvideo -s 400x244 $thumbnail"); how can remove rotation in order exact image orientation? it possible using transpose video filter. cannot rotate 180 degrees, can rotate 90 degrees , chain filter. avconv -i video.mp4 -vf transpose=1,transpose=1 out.mkv see transpose in avconv manpage: http://manpages.ubuntu.com/manpages/quantal/en/man1/avconv.1.html

jquery - CSS and Javascript optimization (Speed issue) -

so trying make wheel navigation system in css , javascript using angular. working fine wondering if there better way optimize less load, works great on new devices pretty slow on older ones. on drag (using hammer js, happening 60 times per second) running code. var pagex = e.gesture.center.pagex; var pagey = e.gesture.center.pagey; currentangle = getangle(pagex, pagey) - updatedangle + originalangle; absoluteangle = getangle(pagex, pagey); circle.style.transform = circle.style.webkittransform = 'rotatez(' + currentangle + 'deg)'; (var = 0; < circles.length; i++) { circles[i].style.transform = circles[i].style.webkittransform = 'rotatez(' + -currentangle + 'deg)'; } where updatedangle , originalangle variables set on start, , getangle function var getangle = function(x, y){ var deltax = x - center.x, deltay = y - center.y, angle = math.atan2(delta

Gson: Serialization from JSON to java object whit inner object list -

i have : public class requisicionimpresion { private list<files> archivos; private string impresora; ... // getter & setters } public class filedto { private string lote; private long iddoc; private string nombre; private string ruta; //getter & setters } i'm getting json: {"archivos":[{"lote":"julio_20160125_001","iddoc":9038,"nombre":"/siat/anexo/pruebas/anexo 1.pdf","ruta":"/siat/anexo/pruebas/anexo 1.pdf"}, {"lote":"julio_20160125_001","iddoc":9185,"nombre":"/siat/anexo/pruebas/anexo 1.pdf","ruta":"/siat/anexo/pruebas/anexo 1.pdf"}, {"lote":"julio_20160125_001","iddoc":9184,"nombre":"/siat/anexo/pruebas/anexo 1.pdf","ruta":"/siat/anexo/pruebas/anexo 1.pdf"}, {"lote":"julio_2016

javascript - Toggle parent DIV's with child elements of similar ID to calculate their price -

i trying that, when below page loaded default show a1 div , calculate price div , display in total e.g. 216. and when user click on change link/button, should hide a1 , display a2 div , calculate price a2 e.g. 201. could guide me how can achieved? have been trying, far no luck. this snapshot of code working, representing logic. hope gives clearer picture of situation. <script type="text/javascript"> function prc_calc() { $price = parseint($('#price').attr('value')); $quantity = parseint($('#quantity').attr('value')); $sum = $price * $quantity; $('#total').text($sum); } function change() { prc_calc(); } $(document).ready(function() { prc_calc(); } </script> <body> <div id="a1" style="display:block"> <span id="price">54</span> <span id="quantity">4<

group policy - How to Create Deny rules for Applocker using Powershell -

when using command such ls 'c:\program files\*.exe' | get-applockerfileinformation | new-applockerpolicy -ruletype path -user -xml -optimize i see emit "allow" rule. how can generate "deny" rule (i.e action="deny") in xml gets generated. msdn documentation not having deny option. xml fiddling way? you modify policy rule objects new-applockerpolicy returns before calling set-applockerpolicy : $policy = ls 'c:\program files\*.exe' | get-applockerfileinformation | new-applockerpolicy -ruletype path -user -optimize foreach($rulecollection in $policy.rulecollections) { foreach($rule in $rulecollection) { $rule.action = 'deny' } } set-applockerpolicy -policyobject $policy -ldap "<dn target policy>" in powershell 4.0 , newer, can use foreach({}) extension method well: $policy = ... | new-applockerpolicy $policy.rulecollections.foreach({ $_.foreach({ $_.action = 'deny' })

Gap of absolutely nothing on my website [HTML/CSS] -

ok, asked question last time, , odd reason closed due being "irrelevant." don't see how "irrelevant" @ all. explained problem thoroughly high detail. second attempt. the problem: there big gap on bottom portion of website. there absolutely nothing there, , have no idea causing problem. image: without explanations with explanations you i'm trying say? big gap want remove. want content end ends, there's big gap of absolutely nothing after it! website fiddle: click this fiddle so if scroll down, can see big gap of absolute nothingness, yes? that's want fix. please me! the top: -382px; causing space below footer. why not use margin: 0 auto; center element. , lastly, there's many tags unclosed . change this: #footer { color: white; text-align: center; background-color: black; top: -382px; position: relative; left: 50%; margin-right: -50%; transform: translate(-50%, -50%); width: auto; height: aut

c++ - mousePressEvent is working but mouseMoveEvent isn't -

Image
both events work on bare mainwindow when press inside graphicsview ,placed inside mainwindow, mousepressevent responding. could clarify issue? upd : here code #include "mainwindow.h" #include "ui_mainwindow.h" #include "mydialog.h" #include <qdebug> mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); scene = new qgraphicsscene(this); ui->graphicsview->setscene(scene); pix = new qpixmap("/users/mac/pictures/wallpaper/rocks.jpg"); scene->addpixmap(*pix); } mainwindow::~mainwindow() { delete ui; } void mainwindow::mousepressevent(qmouseevent *e) { sel_reg_beg_x = e->x(); sel_reg_beg_y = e->y(); qdebug() << "inside press"; } void mainwindow::mousemoveevent(qmouseevent *e) { qdebug() << "inside move"; sel_reg_end_x = e->x(); sel_reg_end_y = e->y(); this->upda

Javascript (Not for Web) need to replace all offending characters -

i writing javascript application allows kind of scripting expand own functionality. (esko) not web. have various text strings various undesirable characters need replace. have works except double quote. have: function f () { //remove illegal characters , replace underscore //list of illegal chars var re = /[\*\"\%\'\@\#\$\%\^\&\*\{\}\[\]\(\)[\]]/gi; var str = "santa fe natural tobacco compa"ny inc %#$%^ american spirit"; var newstr = str.replace(re, ""); //remove double underscores var re = /_+/g; var str = newstr; var newstr = str.replace(re, '_'); return (newstr) } f (); the var str changes every order, different. can change var str line read: var str = 'santa fe natural tobacco compa"ny inc %#$%^ american spirit'; (single quotes) , can double quotes replaced, not singles. need both gone. how can accomplish?? my experience js limited, gentle. thanks your code eliminates " when run in console, ex

Receive Email in phone through SMS in asp.net -

i want code when receive email receive me cell phone through sms. possible in asp.net??? you have eiter use third-party libraries connect special servers , send text message there. second option connect phone pc , configure send messages via communication interface. in both cases prepare charge.

networking - Can't access CouchDB Futon app with external URL -

i can't access couchdb futon app url computer. when use http://192.168.1.3:5984/_utils in computer, works when access same url computer connected in same network, page not loading. can access other apps computer e.g. http://192.168.1.3:8080 or http://192.168.1.3:80 , futon app failing. help? i changed bind_address 0.0.0.0 in local.ini , turned off firewall nothing helped. it should problem of cors, try enable https://wiki.apache.org/couchdb/cors

asp.net - RadGrid PageSizeComboBox is not finding -

the pagesizecombobox of radgrid giving me null result either in itemdatabound event or other event. need selected value of radgrid pagesizecombobox. should pagesizecombobox here code written in itemdatabound event of grid if (e.item griddataitem) { radcombobox pagesizecombo = e.item.findcontrol("pagesizecombobox") radcombobox; } i need control. want on button click event also. can 1 ? please try below code snippet. if (e.item gridpageritem) { gridpageritem pageritem = (gridpageritem)e.item; radcombobox pagesizecombo = (radcombobox)pageritem.findcontrol("pagesizecombobox"); // access combobox here } for more information please check below link. http://jayeshgoyani.blogspot.in/2012/06/customizing-items-of-radgrid-page-size.html

Using a C# DataGridView to update SQL tables? -

i'm making form in program contains datagridview. there specific buttons viewing different tables database, work fine. however, want able edit contents of tables , send changes database. on 'edit bookings' button press, datagridview's data source set data adapter connected sql statement: select * bookings this works fine; output shows table, , have lines: admindatagrid.allowusertodeleterows = true; admindatagrid.allowusertoaddrows = true; to allow editing in data grid. issue having updating input put data grid. if possible update table either on 'update button' press or when different button pressed, have tried using sqlcommandbuilder generate insert , update commands, calling dataadapter.update() think doing quite wrong. can run me through how achieve i'm looking achieve? thanks in advance, michael. in update button: int id; string name; string address; (int = 0; <= admindatagrid.rows.count-1; i++) { id = int.parse(admind

awk - How to parse URL params in shell script -

i have tried same in python parse url params know if there way same in shell script. say, have url value: http://www.abcdsample.com/listservices?a=1&b=10&c=abcdeeff&d=1663889&listservices=a|b required output: url: http://www.abcdsample.com/ service: listservices a=1 b=10 c=abcdeeff d=1663889 listservices=a|b here 1 method: begin{ fs="?" } { url=$1 sub(/[^/]*$/,"",url) print "url:",url sub(/.*[/]/,"",$1) print "service:",$1 n=split($2,b,/&/) (i=1;i<=n;i++) print b[i] } save script.awk , run awk -f script.awk file : url: http://www.abcdsample.com/ service: listservices a=1 b=10 c=abcdeeff d=1663889 listservices=a|b note: work url like: http://www.abcdsample.com/listservices?a=1&b=10&c=abcdeeff&d=1663889&listservices=a|b www.abcdsample.com/listservices?a=1&b=10&c=abcdeeff&d=1663889&listservices=a|b abcdsample.

html - What is this effect of setting line-height in css called? -

i playing around line-height property in css. discovered if set line-height 0.1 2 identical lines both of them combine nicely. did <!doctype html> <html> <head> <style> p.effect { line-height: 0.1; } </style> </head> <body> <p class="effect"> paragraph special line-height.<br> paragraph special line-height.<br> </p> <p> normal paragraph.<br> normal paragraph</p> </body> </html> the line this paragraph special line-height looks nice. question is: is effect given name? xyz font or xyz effect in css? .short { line-height: 0.3; } p { text-shadow: 4px 10px 0px rgba(159, 150, 150, 1); } <pre class="short"> how hell nice? such bad sample create shadow effect. but, why 1 create shadow effect using line-height? css3 supports text-shadow property can have nice shadow lurking around text. totally

sql server - Better use of redundant subquery in sql- case -

i have question sql- statements: possible "define sub query" multiple use in case. sounds bit confusing following example think clear have in mind: select column1, column2, case when <bigsubquery> > 0 <bigsubquery> else 0 end ... how can this, or can use. have such query works wonderful, huge code , not useable maintenance. if using subquery, should put condition in subquery. instance, if have: (select sum(x) . . . ) then do: (select (case when sum(x) > 0 sum(x) else 0 end) . . .

responsive design - Getting Semantic Grids scss foundation 4 to work -

i have 3 sections collapse under default breakpoint not know how collapse own css using scss. default foundation grid works , collapses <div class="row"> <div class="large-4 columns">...</div> <div class="large-4 columns">...</div> <div class="large-4 columns">...</div> </div> i tried below out but doesn't seem collapse <div class="container"> <div class="div1">...</div> <div class="div2">...</div> <div class="div3">...</div> </div> .container{ @include grid-row; .div1 { @include grid-column(4); } .div2 { @include grid-column(4); } .div3 { @include grid-column(4); } } its because writing scss grid-row wrong. @include grid-row(); do not use @extend. not how foundation4 made used... @extend stuffs styles .row , .column , not want do, instead want st

reduce - How can I define a function with uncertain argument in clojure -

i wondering how define function uncertain argument in clojure. here example: (reduce + [1 2 3 4]) => 10 (reduce list [1 2 3 4]) => (1 2 3 4) (reduce inc [3]) => 3 i want define reduce function (reduce func coll) can apply func first 2 elements in coll, apply func result of first 2 elements , third element, until elements used. puzzled different source code of reduce? have no idea how define function far. there can me figure out problem or give me tips? appreciate that! to clear, asking this: apply func first 2 elements in coll, apply func result of first 2 elements , third element, that reduce does: user> (reduce list [1 2 3 4]) (((1 2) 3) 4) the list of first 2 (1 2) . then, apply list function result , next element, 3 , ((1 2) 3) . , continue until elements used up. i suspect not asking question correctly or clearly. -- i see asking not how create function want different reduce rather how implement reduce yourself? if case, typical

ios - How to Custom group notify for blocks of functions -

Image
asynchronous block called in function, add these multiple functions group,process results of blocks when block execute completely.is there common , smart method implement? dispatch_group_notify ,completionblock dispatch_group_t _blocktaskgroup; ..... if (!_blocktaskgroup) { _blocktaskgroup = dispatch_group_create(); } dispatch_group_notify(_blocktaskgroup, dispatch_get_global_queue(dispatch_queue_priority_background, 0), ^{ nslog(@"finally!"); }); .... dispatch_group_enter(_blocktaskgroup); [xxxxx computeinbackground:xx completion:^{ nslog(@"1 done"); dispatch_group_leave(group); }]; // dispatch_group_enter(_blocktaskgroup); [xxxxx computeinbackground:xx completion:^{ nslog(@"2 done"); dispatch_group_leave(_blocktaskgroup); }]; // dispatch_group_enter(_blocktaskgroup); [xxxxx computeinbackground:xx completion:^{ nslog(@"3 done"); dispatch_group_leave(_blocktaskgroup); }];

android - Record and play video in portrait -

hi guys have been trying record video in portrait mode , play after uploading aws s3. video plays in landscape mode ie. video rotated 90 degree clockwise. tried record video setting landscape orientation recording activity still same thing happens. while recording portrait used usepreviewdisplay method rotate preview 90 degree , know doesn't affect recording. when orientationhint 270 able play video in portrait on latest devices android 4.0 +, not other version. need play same video on web portal , using jw player playing videos on web. need play same video on ios to. how can acheive this. or ideas appreciated. in advance. file file = new file(path, filename); mrec = new mediarecorder(); mcamera.lock(); mcamera.unlock(); mrec.setcamera(mcamera); mrec.setvideosource(mediarecorder.videosource.camera); mrec.setaudiosource(mediarecorder.audiosource.mic); mrec.setoutputformat(mediarecorder.outputformat.mpeg_4); mrec.setvideoencoder(mediarecorder.videoencoder.mpeg_4_sp); mrec.set

ruby on rails - How Do I Call An Array Written in My Model -

greeting create array in model , reference later view or helper. how do this? this in events model. users can select lunch type(1,2,3) event. instead of hard-coding sandwich names, can change, in view, thought keep names in 1 place (model) reference name based on lunch type chosen. sandwiches = { 1 => 'turkey', 2 => 'veggie', 3 => 'roast beef' } how call script in app view or helper? event.sandwiches[1] not work event_obj.sandwiches[1] not work thanks help. what have there constant , need access event::sandwiches .

iphone - NSInternalInconsistencyException with 'CGPDFDocumentRef == NULL' -

i building newsstand universal app. when download magazine issue , open it, runs fine, when delete it, redownload, , open it throws following: 2013-04-01 22:06:07.672 magazine[14353:707] *** assertion failure in -[readercontentpage initwithurl:page:password:], /volumes/files/work in progress/el-beit/magazine/sources/readercontentpage.m:471 2013-04-01 22:06:07.680 magazine[14353:707] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'cgpdfdocumentref == null' *** first throw call stack: (0x35a4788f 0x3366b259 0x35a47789 0x34e3b3a3 0x84e59 0x85ba7 0x96d47 0x976ad 0x34e6d933 0x35a1ba33 0x35a1b699 0x35a1a26f 0x3599d4a5 0x3599d36d 0x33738439 0x33175cd5 0x6cf81 0x6cf08) terminate called throwing exception(lldb) i delete file deleting issue: nklibrary *nklib = [nklibrary sharedlibrary]; nkissue *issue = [nklib issuewithname:[kbasefeatureid stringbyappendingstring:((nsnumber *)self.listofmonths[index]).stringvalue]]; nsstring *name

php - Get $_POST from multiple checkboxes with same value in different row -

Image
how can put form in database database photo and form photo i need manipulate database through form please help this code of form how can make submit file this: </style> <form action="submitregister.php" method="post"> <div class = "register"> <div class="container"> </script> <h2><b><font color="black">user group maintenace</font></b></h2> <img src="icon/logss.png" width="972" height="54" alt=""/> <th> <label for="acode"><b><font color="black">access code</font></b></label> <input type="text" id="acode" name="acode" required /></th> <label for="desc"><b><font color="black">description</font></b></label> <input type="text&quo

sql - Select rows with unique attribute -

i have following table ind_id name value date ----------- -------------------- ----------- ---------- 1 10 2010-01-01 1 20 2010-01-02 1 30 2010-01-03 2 b 40 2010-01-01 2 b 50 2010-01-02 2 b 60 2010-01-03 2 b 70 2010-01-04 3 c 80 2010-01-01 3 c 90 2010-01-02 3 c 100 2010-01-03 3 c 110 2010-01-04 3 c 120 2010-01-05 4 d 130 2010-01-05 how can select rows unique ind_id attribute? no matter rows each ind_id . need 4 rows in result set. i'm using sql server 2008. thanks

How to access variable inside jquery promise -

i have variable declared inside function , same function contain code ajax call. want access variable inside .done , fail & always function of promise . on consoling inside done logging undefined // rest of code click:function(event){ var gettrtcode = "somevar"; var makecall = $.ajax({ url:"someurl" }) makecall.done(function(response){ console.log(" ******* "+gettrtcode); }) .always(function(){ }) } edit i dont want make gettrtcode global variable

Get group members count using facebook api -

actually can members list open group on facebook using get /v2.4/{group-id} http/1.1 . problem is, query return me not users on group. i.e, group have 2020 members , graph api returns me list of size 1980. happens 40 members? there way can amount of members?, been digging on facebook api can't figure out. there no way exact amount, users may have deactivated app platform. can never sure access everyone, there no reliable way correct group members count.

c++ - CPP, Variables don't go out of scope -

in other experiments have done, variables go out of scope intended, when put variables in main method, don't go out of scope or that's seems because destructor never gets called: #include <string> #include <iostream> using namespace std; #define print(s) cout << s #define println(s) print(s) << endl class animal { public: string name; int legs; animal(string name, int legs) { this->name = name; this->legs = legs; } ~animal(){ println("deleting"); } static animal createanimal() { println("creating"); return animal("animal", 4); } }; int main() { println("start"); animal = animal::createanimal();//or animal a("hello", 5); println("end running method"); println("end"); system("pause"); return 0; //should print out "deleting" here //because of goin

what is the difference between --force-rm and --rm when running docker build command -

when build docker images using docker build command have 2 options --force-rm=true , --rm=true remove intermediate containers. difference between these 2 options , in scenarios should each used. docker build has: --rm=true remove intermediate containers after successful build that means that, in case of unsuccessful build, intermediate containers not removed. allows debugging last intermediate container, or committing intermediate image. but --force-rm=true , intermediate containers always been removed in case of unsuccessful compilation.

android - Cling how to install from github? -

i trying include project cling , before never used manually install maven. on page instructions is: install maven 3.2.3 or newer. install android sdk , set android_home environment variable sdk install directory. clone cling source: git clone https://github.com/4thline/cling.git change cling/ directory. install local ~/.m2 maven repository (this take few minutes if dependencies have downloaded first time). mvn clean install if build fails android/dex packaging errors, forgot clean. use cling in pom.xml with: don't know why, pom.xml not insert here you can see pom.xml on github page i have done 1,2,3,4 steps, "install everything" in step 5, how ? , last step pom.xml , need put it? step 5 comes down running command mvn clean install command line. maven configured of file, called pom file . xml file named pom.xml . file contains maven during build. 1 of things compile java sources final artifact. compile source code, needs resolv

c# - Bound value to a hiddenfield inside a datalist is not specific to an item -

i'm beginner asp.net(c#) , i'm working on social networking application. i've stuck on status update , comment section. want when page loaded threads(status') should have ids in hiddenfields inside datalist i've created itemtemplate status , assigned thread_id hiddenfield. problem hiddenfield not having different values different items. don't know i'm doing mistake. please me. here code datalist: <asp:datalist id="dataliststatus" runat="server" repeatcolumns="1" onitemdatabound="dataliststatus_itemdatabound" onitemcommand="dataliststatus_itemcommand"> <itemtemplate> <table width="550px"> <tr><asp:hiddenfield id="hfieldthreadid" value='<%#eval("thread_id") %>' runat="server" /> <td style="vertical-align:top; width:50px;" align=&

How do I sort out this git mess? Files on server ahead by two commits -

this question has answer here: reset local repository branch remote repository head 17 answers whenever git pull on server, message; your branch ahead of origin/master 2 commits. the 2 should in sync. don't know how got here. have in origin/master want on server. don't care if lose changes last couple of commits, nothing vital. how these in sync can push , pull normal again? edit: ran git checkout origin/master , got code on server previous state, i'm in detached head state. how out of that? this message means master branch on server, has commits not in remote. if committed on server , aren't expecting ever commit particular checkout - cause situation. to see 2 commits are .. not in remote: git log origin/master..head # commit messages git diff origin/master..head # diff to remove these 2 commits if 2 commits exist don't

iis - Canonical Redirect on the server only -

i can redirect domain.com-s on www.domain.com , it's working on server charm: <rewrite> <rules> <rule name="canonical host name" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{http_host}" negate="true" pattern="^www\.domain\.com$" /> </conditions> <action type="redirect" url="http://www.domain.com/{r:1}" redirecttype="permanent" /> </rule> </rules> </rewrite> but has 1 side effect - working when on testing environment, on localhost , redirects on production server. how possible add condition work on server only? this can achieved using second condition requesting host domain.com sub-domain: <rewrite> <rules> <rule name="canonical host name" stopprocessing="

tranfer of resultset from jsp to html page -

i have created html page,on login provided had search on mysql using .jsp file, , got resultset. resultset want send login id page through jsp (and html page loaded , have login id.) here can <% while (rs.next()) { %> //create html here <div> <%=rs.getstring(1)%> </div> //html ends here <% } %> and refer how make java resultset available in jsp? proper mvc structure.