Posts

Showing posts from July, 2013

MySql from unix time gives 1 hour too much -

small question bothering me while now. i'm creating query gets data mysql database. in data 1 field time , saved unix time in case lets 7500 value. 7500 converted 02:05 in time, when query database result 03:05 . have checked time zone of server, mysql server , computer , there same. my query: select timebilled `ticket_time`, from_unixtime(timebilled, '%h:%i') `ticket_time_parsed` data_table so how fix this? edit: i solved problem changing time on windows server 2012 uct+1 utc. value 7500 02:05 me. help. whatever use convert 02:05 7500 not respecting timezone should. 7500 02:05 in utc, in utc+1. 02:05 should converted 3900 . but if storing time of day , don’t want timezone conversions, stay away unixtime , store seconds till 00:00 , convert myself.

Need to query list of youtube videos in javascript -- v3 APIs wont work -

please forgive me ranting, 1 giving me headache... rant on---great pain google programming apis. trying use google apis communicate youtube retrieve list of videos. simple task. version 2 apis easy use, had sample working in 5 minutes. new version 3 apis complex, tedious, require bunch of advance setup , user account ids, , after hassle, still not work.---rant off c'mon google, hard use! ok, down business: have api key , client auth setup. neither 1 works efforts use google's sample code. does have working sample javascript in html lists videos in youtube account? can substitute account id , api key. should simple, yes? thanks in advance help... , bearing me rant... this sample offical docs works fine. need put client id in oauth2_client_id variable in auth.js . make sure you're using id that's in ' client id web application ' section in developers console. if can't work, more specific error you're getting.

javascript - Google Maps v3 zoom produces artifacts squares not loading -

Image
we using google maps v3 web api , getting weird graphical aritfacts after zooming map. problem not occur, perhaps 30% of time. has experienced problem before? <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

database - How to select first record prior/after a given timestamp in KDB? -

i pulling in records 1min leading timestamp (e.g. if timestamp i'm interested in 2014.04.14t09:30 ): select prices timestamp within 2014.04.14t09:29 2014.04.14t09:30, stock=`goog however, not robust. previous record may @ 09:25am , query returns nothing. query may return hundreds of records if there have been lot of price changes, though need last record returned. i know can done asof join, want avoid time being prices big @ present. i interested in doing same, in finding first record after given timestamp. note prices splayed table select last record before given timestamp: q)select price timestamp<2014.04.14t09:30,stock=`goog,i=last select first record after given timestamp: q)select price timestamp>2014.04.14t09:30,stock=`goog,i=first

Android: How to use Parse as an alternative GCM push notification provider? -

see edit#2 @ end of question (google updated way push implemented became easier handle gcm , parse together) i use gcm inside application , add parse alternative. have (all permissions correctly declared): <service android:name="com.mypackagename.gcmintentservice" android:enabled="true" /> <receiver android:name="com.google.android.gcm.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="com.mypackagename.gcmintentservice" /> </intent-filter> </receiver> the 'gcmintentservice' (inherits 'gcmbaseintentservice') class handles server registration , receiving of messages - works fine , push messages rec...

asp.net - Crystal Report Templates & Images not displayed -

Image
i using crystal report template vs 2013. have used web form & use crystal report viewer itself. the following aspx page code is:: <head runat="server"> <title></title> <script type="text/javascript" src="../crystalreportviewers13/js/crviewer/crv.js"></script> </head> <body> <form id="form1" runat="server"> <div> <cr:crystalreportviewer id="crystalreportviewer1" runat="server" enabledrilldown="true" hasrefreshbutton="true" hasgotopagebutton="true" displaystatusbar="true" displaytoolbar="true" enableparameterprompt="true" hascrystallogo="false" hasexportbutton="true" hastoggleparameterpanelbutton="true" ...

iphone - How to make ios applications run in background and foreground on events -

i having application listen sounds ans give messages on frequencies.the program uses iphone microphone listening. i want run in background , popup when particular event occurs. there way this.so need not run app in foreground always.only when event occurs should come foreground. app couldn't bring foreground. user it. use local notifications. user see banner or alert , if taps on app bring foreground. example: uilocalnotification *notification = [[uilocalnotification alloc] init]; notification.alertbody = @"event occurs"; notification.alertaction = @"open"; [[uiapplication sharedapplication] presentlocalnotificationnow:notification];

Code confusion while extending PHP exception class -

this question related extending php exception class , there many similar questions 1 different. i trying extend php exception class can add values exception message. below code. class om_exception extends exception { public function __construct($message, $code = 0, exception $previous = null) { $message = $this->_getmessage($message); parent::__construct($message, $code, $previous); } protected function _getmessage($message) { $exception = '<br />'; $exception .= '<b>exception => </b>'.$message.'<br />'; $exception .= '<b>class => </b>'.get_called_class().'<br />'; $exception .= '<b>error line => </b>'.$this->getline().'<br />'; $exception .= '<b>error file => </b>'.$this->getfile().'<br />'; return $exception; } } this works...

php - Magento subscribe form not showing -

i'm working on website , page doesn't show subscribe form... i've added newsletter.xml: <!-- mage_newsletter --> <reference name="newsletter"> <block type="newsletter/subscribe" name="news.subscribe" as="news.subscribe" template="newsletter/subscribe.phtml"/> </reference> </default> and news_home.phtml: <section id="news_and_fun_home" class="block small"> <div class="block-top"></div> <div class="block"> <a href="https://plus.google.com/u/0/105681634975039284210/posts" target="_blank"><div class="follow-google"></div></a> <?php echo $this->getchildhtml('news.subscribe'); ?> </div> <div class="block-bottom"></div> </section> i'm kinda new in magento... c...

sql server - Conversion in SQL -

what code do? sum(convert(decimal(12,2), convert(decimal(12,2), datediff(mi,thistimelastyear,timetoday))/60)) i understand query doing why have use convert decimal twice make statement work? got query produce result wanted want know why came me try before getting desired result. because without both converts, first perform datediff_result/60 integer division, , then convert decimal. there other ways force division not done between integers. simplest be: sum(convert(decimal(12,2), datediff(mi,thistimelastyear,timetoday)/60.0)) but, since return type of sum() defined decimal(38,s) , if need control on data type, ought be: convert(decimal(12,2),sum( datediff(mi,thistimelastyear,timetoday)/60.0))

java - Full Dataset Export blank dataset -

i have database in libreoffice base (debian) need export tables xml file. have created piece of eclipse java code follows: package newdb; import java.io.fileoutputstream; import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; import org.dbunit.database.databaseconnection; import org.dbunit.database.idatabaseconnection; import org.dbunit.database.querydataset; import org.dbunit.dataset.idataset; import org.dbunit.dataset.xml.flatxmldataset; import org.dbunit.dataset.datasetexception; public class extracttestdataset { public static void main(string[] args) throws exception { // database connection class driverclass = class.forname("org.hsqldb.jdbcdriver"); connection jdbcconnection = drivermanager.getconnection "jdbc:hsqldb:/home/debian/documents/database.odb", "sa", ""); idatabaseconnection connection = new databaseconnection(jdbcconnection); // full database export idataset ful...

java - Read Ydata from video frame -

i want read y(luminance data consecutive frames of .mp4 file) in java code. how can able that.it if don't have use media library ffmpeg/opencv.actually applying following simple blockiness algorithm on .mp4 file. 1.luminance gradient image first segmented blocks of 32×32 pixels. 2.each block fast fourier transformed frequency domain. 3.following this, measure ratio of sum of harmonics sum of ac components,in both horizontal , vertical orientations. ratios serve indication of severity of blocking artefacts. any pointers on code samples(fft,measuring sum of harmonics of fft) regards, mayank "it if don't have use media library ffmpeg/opencv" good, impossible. video highly compressed, zip file way more complex. , zip files, can not see inside without decompressing it. decompress, recommend using libavformat/libavcodec ffmpeg library. use libswscale (also ffmpeg) convert frame yuv (if codec uses different color space). , fftw analysis. good luck, big p...

go - What is the use of tag in golang struct? -

i don't understand significance of struct tags. have been looking them, , noticed can used reflect package. don't know practical uses of them. type tagtype struct { // tags field1 bool “an important answer” field2 string “the name of thing” field3 int “how there are” } the use of tags depends on how struct used. a typical use add specifications or constraints persistence or serialisation. for example, when using json parser/encoder , tags used specify how struct read json or written in json, when default encoding scheme (i.e. name of field) isn't used. here few examples json package documentation : // field ignored package. field int `json:"-"` // field appears in json key "myname". field int `json:"myname"` // field appears in json key "myname" , // field omitted object if value empty, // defined above. field int `json:"myname,omitempty"` // field appears in json key "field...

javascript - Access JSON object to get Resource Bundle key/value pair -

i know how access key value pair json object in case, resource bundle keys mapped values. e.g. var json = {"label.name.first":"foo","label.name.second":"bar"}; here json.label.name.first doesn't give me "foo". can me this? due using period character ( . ) in key name, need use [] notation access value. console.log( json['label.name.first'] ); additionally, have javascript object, not json. the difference between javascript object or json json string. secondly, javascript objects don't require same quote standards on key names. if consider string below, yes can considred json (this why if paste json parser, tells it's valid json): {"label.name.first":"foo","label.name.second":"bar"} however, if assign directly javascript variable have javascript object literal, not json. because json valid javascript object/array literal when not contained in...

geospatial - How to transform from SRID 4258 to 4326 in PostGIs -

i have column polygons srid 4258, have been trying transform column srid 4326 not transform correctly. i have done using 2 commands: select updategeometrysrid('lig','geom',4326); update lig set geom=st_transform(st_setsrid(geom, 4258), 4326); any clues? mean should work! thanks in advance! i'm guessing using postgis 2.x, can directly specify alter table ddl change definition of table , update column required st_transform: alter table lig alter column geom type geometry(polygon, 4326) using st_transform(st_setsrid(geom, 4258), 4326); if still using postgis 1.x, follow of these instructions modify geometry type .

javascript - Tagging Status in the Image -

i have phonejs project, created web, using html , js. need have page containing project construction plan/highrsie building plan image. there numbers of lots in image, lot 1-20 example, having status available, sold, booked etc. want make user can tag in image status corresponding lot, maybe differentiate colour, example red=sold, green=available, etc, , status can save database. suggest me on best way/method accomplishing this? lot in advance. i have tried using canvas. following code. html <div data-options="dxview : { name: 'status_tagging', title: 'status_tagging' } " > <div data-options="dxcontent : { targetplaceholder: 'content' } " > <h4>drag status corresponding lot.</h4> <img id="available" width=32 height=32 src="images/available.png"> <img id="booked" width=32 height=32 src="images/booked.png"> <img id="hold" width=32 ...

how to upload file to Amazon s3 based on angularjs and ruby -

i trying use ng-s3upload me file upload aws based on angualrjs. in read me file, forth point sever side code. quite confused should put ruby code in ruby application, example folder, , should change on policy, signature , key. is there use ng-s3upload before? in advance if me on that!

php - Run queries to MS SQL server with strange table names -

for application need connect sql server 2008 queries. i run queries in php on codeigniter framework. access sql database program called "microsoft sql server management studio". tables have strange names dollar signs: trp$lease car example. the studio data query: select top 1000 * [mdatabase].[dbo].[trp$lease car] when run query in php installation fails on $ sign: $data = $this->db->query("select * dbo.trp$lease car"); like this: a php error encountered severity: notice message: undefined variable: lease filename: views/welcome_message.php line number: 5 database error occurred error number: 42s02 [microsoft][sql server native client 11.0][sql server]invalid object name 'dbo.trp'. how need call these tables when running query php? edit the problem appears on tables space in name... query trp$invoice works. in case trp$lease car problem think.. this due fact have query in...

algorithm - merge sort using recursion in c languaage -

#include<stdio.h> #include<conio.h> int arr[20]; void main() { int n,i; clrscr(); printf("\n\t\t\t------merge sorting------\n\n"); printf("enter size of array\n"); scanf("%d",&n); printf("enter elements:\n"); for(i=0; < n; i++) { scanf("%d",&arr[i]); } merge_sort(arr,0,n-1); printf("\n\n\t\t\t-----merge sorted elements-----\n\n"); printf("sorted array:\t"); for(i=0; < n; i++) { printf("\t%d",arr[i]); } getch(); } int merge_sort(int arr[],int low,int high) { int mid; if(low < high) { mid=(low+high)/2; merge_sort(arr,low,mid); merge_sort(arr,mid+1,high); merge(arr,low,mid,high); } } int merge(int arr[],int l,int m,int h) { int arr1[10],arr2[10]; int n1,n2,i,j,k; n1=m-l+1; n2=h-m; for(i=0; < n1; i++) { arr1[i...

Assembly change return address -

is there way can change return address. as need either return program when interrupt occurred 1 situation, need restart. i using microcontroller program called sms32v50 for normal return path, return (i.e. ret ). to restart, jump initialization code via jmp . note have deal resetting stack/heap @ location jumping to.

c# - Set options to FbTransaction -

how can set options fbtransaction write nowait rec_version read_committed in code execute insert/update sql statements: fbconnectionstringbuilder fbconnstr = new fbconnectionstringbuilder(); using (fbconnection fbconn = new fbconnection(fbconnstr)) { fbconn.open(); using (fbtransaction fbtran = fbconn.begintransaction()) { using (fbcommand fbcmd = new fbcommand("insert test values (1)", fbconn, fbtran) { fbcmd.commandtype = commandtype.text; fbcmd.executenonquery(); fbcmd.transaction.commit(); } } fbconn.close(); } you use fbtransactionoptions : fbtransaction transaction = connection.begintransaction( fbtransactionoptions.readcommitted | fbtransactionoptions.write| fbtransactionoptions.recversion| fbtransactionoptions.nowait | ); look @ isolationlevel : isolationlevel.readuncommitted isolationlevel.readcommitted isolationlevel.repeatableread isolationlevel.serializa...

php - Overriding Joomla 3.0 components. Possible to override model and controller too? Not just views? -

i understand ability overide core views in joomla using overides, how models , controllers? ability add field core user registration form, joomla pulls fields xml located in models folder. create plugin, creates own section, , need go exclusively in main registration form, creating tiered registration. my question how title implies, can create component overrides of model , controller files in joomla, rather views? further, know "could", in event of update want make sure acceptable override solution - not hack subject overwritten. thanks!! yes can, used mvc override 1.0.11, joomla 3.x compatible. in case used override /models component com_tag structure in template in form: /code/your_component/models/tag.php above example and can override correctly. link is: http://gruz.org.ua/en/extensions/joomla-mvc-override/1_0_11.html

javascript - Change Active Menu Item on Page Scroll? -

i want activate menu item when it's corresponding section. got inspired previous question: change active menu item on page scroll? . but difference in menu have little image on each menu item, shows if hover menu item, , hides when don't. html <nav> <ul id="pics"> <a href="#def"><li id="text-what"><img src="images/what.png" id="pic-what" class="vishid"><p>item1</p></li></a> <a href="#program"><li id="text-training"><img src="images/training.png" id="pic-training" class="vishid"><p>item2</p></li></a> <a href="#testi"><li id="text-testi"><img src="images/trait.png" id="pic-testi" class="vishid"><p>item3</p></li></a> <a href=...

sql - create trigger after delete -

when row deleted titles_in_stock table, want insert equivalent row in table named titles_in_stock_out . i tried following create trigger titles_in_stock_out on titles_in_stock after delete begin insert titles_in_stock_out (cd_title, invenotry, cd_type) values (deleted.cd_title, deleted.invenotry, deleted.cd_type) end but gives following error when tried execute above statement. msg 128, level 15, state 1, procedure titles_in_stock_out, line 8 name "deleted.cd_title" not permitted in context. valid expressions constants, constant expressions, , (in contexts) variables. column names not permitted. any help? thanks your syntax incorrect. deleted virtual table available in trigger, must refer table. create trigger titles_in_stock_out on titles_in_stock after delete begin insert titles_in_stock_out (cd_title, invenotry, cd_type) select cd_title, invenotry, cd_type deleted ...

Stop jenkin's email notification -

i noticing strange behavior , want see if guys have suggestion me. have 3 jenkins instances running: 1 x production 2 x qa we have email-ext plugin installed use sending emails. trying achieve stop email generation our qa servers, unable so. @ present , cannot change configuration since have cron syncs prod. cannot specify absurd in host section of manage-jenkins. under impression jenkins use service such sendmail/postfix on host send emails seems incorrect. we disabled email servers(sendmail/postfix) renamed javamail.jar javamail.jar.bak but still keep getting notifications build failures. there know mechanism can stop these notifications apart changing configuration? not answer problem above workaround. added junk entries in /etc/hosts file against smtp host 0.0.0.0 uksmtp.xyz.com post this, jenkins unable send emails under circumstance.

Tel and SMS Links Not Working in TWebbrowser Within Delphi XE5 Android App -

i've been struggling days, , appreciate can give. tel: , sms: links work fine in web browser on android. not work @ within twebbrowser. i found code opening links natively, works fine, cannot figure out how fire function within twebbrowser. there few windows-only solutions around involving type libraries, nothing seems work on android. is there way call native function web page in twebbrowser in delphi xe5 firemonkey mobile app? alternatively, there way tel , sms links working within twebbrowser? in case wondering this, stated in question, twebbrowser on xe5 on android doesn't open of useful links find in webview app - namely sms, tel, or mailto links. i solved rewriting shouldoverrideurlloading function in fmx.webbrowser.android. in order use modified unit, copy fmx.webbrowser.android.pas project directory, add project. change following original function: function tandroidwebbrowserservice.twebbrowserlistener.shouldoverrideurlloading( p1: jwe...

ios - Is UICollectionView.backgroundView broken -

i'm writing relatively simple, or thought. firstly, code, i'm trying place image on background of uicollectionview if there no results returned server. image 200 200: uiview *myview = [[uiview alloc] initwithframe:self.view.bounds]; cgrect myviewspace = self.view.bounds; cgfloat myx = (myviewspace.size.width /2.0) - 100; cgfloat myy = (myviewspace.size.height /2.0) - 100; uiimageview *imview = [[uiimageview alloc] initwithframe:cgrectmake(myx, myy, 200, 200)]; imview.image = [uiimage imagenamed:@"imnothome"]; [myview addsubview:imview]; mycollectionview.backgroundview = myview; once there results, want able remove it. i thought it'd simple placing following, before reloaded uicollectionview : [mycollectionview.backgroundview removefromsuperview]; however, appears doing nothing. am missing something? thanks in advance! it should done way instead: mycollectionview.backgroundview = nil; explanation: should unset uicollectionview'...

.net - Datatable reset to initial sort order -

is there way remove sort order datatable? know function datatable.select sort using specific column (or combination of columns) remove sorting completetly. to explain little bit more: unknown number of unsorted data rows in string, show in datagrid control. due performance reasons data transfered datatable (call "init_data") , datatable bound datagrid (wpf right not important problem). during sorting in datatgrid, have sort "init_data" using select function. might thousands of rows, cannot keep original "init_data" have transfer sorted data new datatable (call "sort_data") but once datatable sorted, cannot display original sort order again. any ideas? regards klaus create column support sort , number 1 - x. sort on column original back.

c# - ComboBox selection returning IndexOutofBounds Error -

Image
i setting such choice of first combobox(name = combo3) determines second combobox(name = combo4) show. works fine. now trying make second combobox determine third combobox show. doesn't work. moment make selection on second combox, jams , returns error. if hard code value of 2nd combobox, works. i getting indexoutofbounds exception. problem seems method private void combobox_selectionchanged2(). please advice wrong. thanks. mainwindow string[] tablearray = { "agent_name", "agent_age", "agent_gender", "agent_alias", "security_clearance", "dept_id", "job_id", "mission_id" }; string[] attributearray = { "mission_name", "mission_description", "mission_country", "mission_city" }; private void combobox_selectionchanged1(object sender, selectionchangedeventargs e) { if (((comboboxitem)combo3.selecteditem).content.tostring() == "age...

Passing Firebase Auth Token via SSL to App server -

i have rather heavy/complicated logic needs reside on app server. the client request app server perform tasks on firebase data. is safe pass user.firebaseauthtoken via ssl (in post, not url encode) app server, server use token authentication? the auth token firebase simple login being passed on ssl firebase client - pass app server on ssl isn't different. one thing might consider eliminating need post app server. can setup worker node takes advantage of firebase's real-time data sync listen changes user's data, , execute whatever processing needs when detects change/state.

actionscript 3 - XML and Dynamic Textfields -

i'm trying import content of xml inside dynamic textfields. managed it, project asks more: basically, have list of names (say auguste, tibere, claude). when click on 1 of them, biography of him appears (an image , several textfields). 2 textfields filled parts of xml depending of name clicked. part doesn't work... no matter name click, textfields don't change. hope can :). here code: var myxml:xml = new xml(); var xml_url:string = "assets/fiches.xml"; var myxmlurl:urlrequest = new urlrequest(xml_url); var myloader:urlloader = new urlloader(myxmlurl); myloader.addeventlistener("complete", xmlloaded); var list:number = 0; function xmlloaded(event:event):void{ myxml = xml(myloader.data); fnpeople(myxml); }; function fnpeople(peoplelist:xml):void{ nom.text = peoplelist.person.name.text()[list]; vie.text = peoplelist.person.comment.text()[list]; }; /*auguste*/ liste_a1.auguste_liste.addeventlistener(mouseevent.click, fl_auguste); function fl...

windows - How to execute a Matlab function in MS Visual C++? -

i have 2 separate functions 1 in ms visual c++ , in matlab. how execute matlab file in ms visual? there windows function load .m file , execute straightly? two ways run matlab code in c++: call matlab engine directly. the target machine needs have matlab installed. check out call matlab functions c , c++ applications more info , examples. distribute matlab code independent shared library (dlls). the target machine needs have matlab compiler runtime. check out here on how (with detail steps , example).

ios - Change videoview frame in AVCam -

i used avcam version of 3.1. set video gravity avlayervideogravityresizeaspectfill . want change frame - (void)setsession:(avcapturesession *)session { ((avplayerlayer *)[self layer]).videogravity = avlayervideogravityresizeaspectfill; [((avplayerlayer *)[self layer]) setframe:cgrectmake(0, 0, 320, 240)]; [(avcapturevideopreviewlayer *)[self layer] setsession:session]; } but when run project, video frame not change or has different frame size. found videorect object in avcam . object property readonly, can not set it. how can solve problem ?

html - Table inside inline-block element breaks vertical alignment -

Image
when putting table inside inline-block element, inline-block elements next shifted down, instead of tops of elements being aligned. html <div> <table> <tr> <td>cell</td> <td>cell</td> </tr> <tr> <td>cell</td> <td>cell</td> </tr> </table> </div> <div>element</div> <div>element</div> css div { display: inline-block; border: 1px solid #000; } result jsfiddle http://jsfiddle.net/dk39j/1/ why happen, , can prevent it? you need set vertical-align:top; divs beside it jsfiddle

python - How to get value from SQLAlchemy instance by column name? -

i have table this: class mpttpages(base): __tablename__ = "mptt_pages" parent = none id = column(integer, primary_key=true) left = column("lft", integer, nullable=false) right = column("rgt", integer, nullable=false) name = column(string) description = column(text) visible = column(boolean) def __repr__(self): return "mpttpages(%s, %d, %d)" % (self.id, self.left, self.right) how value instance mpttpages column name 'lft'? instance has no attribute lft, left. inspect instance's mapped class mapping of attribute names columns. if column name matches name you're looking for, attribute name instance. from sqlalchemy import inspect def getattr_from_column_name(instance, name, default=ellipsis): attr, column in inspect(instance.__class__).c.items(): if column.name == name: return getattr(instance, attr) if default ellipsis: raise k...

c# - Fix a string from supplied data -

let's have these items in list full of strings: cash cheque postal order credit card bank transfer etc... etc... etc... i found nice thing called "levenshteindistance". working point. not return correct string if type wrong. i thinking of going regex side this. basically want type, example, "chq" , should return "cheque". i have code try not working correctly: foreach (string entry in lsbsupplieddata.items) { entr = entry.trim().replace(" ", ""); regex = new regex("^[" + inputstring + "]+$", regexoptions.ignorecase); if (regex.ismatch(inputstring)) { proposal = entry; //break; } } can please me right direction? have list items should suggest, @ max 20 items (not big, performance not big issue). you can try this: var words = new[] { "cash", "cheque" ... }; string search = "chq"; var results = words ...

Converting BSON Type ObjectId to JSON (Storing in Mongodb) -Java -

new gson().tojson(new objectid()) when above, output "_id" : { "_time" : 1374347520 , "_machine" : -1025067326 , "_inc" : 585905201 , "_new" : false} but want "_id":{"$oid":51eae100c2e6b6c222ec3431} which usual mongodb id format. preferable method in java this? update: my value object import com.google.gson.annotations.serializedname; import org.bson.types.objectid; public class taskobject { @serializedname("_id") private objectid _id; @serializedname("revno") private int revno; } i trying store mongodb custom _id taskobject taskobject = new taskobject(); taskobject.set_id(new objectid()); taskmongodbclient.getinstance(). persistnewtaskdata(new gson().tojson(taskobject)); what stored in mongodb looks this. _id: { "_time" : 1397464341 , "_machine" : 1441187434 , "_inc" : -1687457948 , "_new" :...

Force Google Maps Javascript API to Lite Mode -

i'm trying zoom levels on 19 locations in istanbul/turkey in google maps javascript api v3. can zoom level up-to 23 in "roadmap" map type. however, when change "hybrid", can max zoom level of 19. same problem exits in google maps v3 also. can see in links below can't same zoom level in "earth" mode, map automatically zooms out when it's change map->earth. a sample location in map mode the same location in earth mode i've found forcing google maps open in lite mode it's possible zoom levels on 19 same location in earth mode. so, there way force google maps javascript api load in lite mode, or how can zoom levels on 19 in hybrid mode such locations. this not problem google doesn't have such satellite images proper resolutions in points on high zoom levels. i suggest use maximum zoom imagery service . service returns maximum zoom level @ given point satellite images. therefore, can use reference zoom level of r...

html - JavaScript scroll and focus -

in application have displayed records in div set overflow : auto. task i'am trying accomplish is: after clicking button adding new record database, reload page , if content of div in overflow mode scrool down bottom of div. also in code behind after adding record can obtain id of control represents new record. i'am using framework 1.1 steps/tehniques should use accomplish task ? you can scroll last item function scrollintoview. exemple, if div's id "content" , elements 'p' : var elements = document.getelementbyid('content').getelementsbytagname('p'); elements[elements.length - 1].scrollintoview();

android - How can I send a "fire and forget" async call with Retrofit? -

i'd send async requests never return response (logging, business events, etc). supported retrofit? use empty callback: public final class callbacks { private static final callback<object> empty = new callback<object> { @override public void success(object value, response response) {} @override public void failure(retrofiterror error) {} } @suppresswarnings("unchecked") public static <t> callback<t> empty() { return (callback<t>) empty; } } and in code: apiservice.someendpoint(callbacks.empty());

How to use Sharepoint Server Search (KeywordQuery class) to search through a sharepoint list? -

we have requirement users allowed search list called "reports" front-end, , advanced search, such author:"john smith" or filetype:docx , supported. we decided can achieved using sharepoint server search api (using keyword query language ). also, since possible users don't have access items in list, decided go approach use web method elevated privileges query list. this attempt far... public string getsearchresults(string listname, string searchquery) { spuser superuser = spcontext.current.web.allusers[@"sharepoint\system"]; using (spsite site = new spsite(spcontext.current.web.url, superuser.usertoken)) { keywordquery keywordquery = new keywordquery(site); keywordquery.querytext = searchquery; //where should listname specified? searchexecutor searchexecutor = new searchexecutor(); resulttablecollection resulttablecollection = searchexecutor.executequery(keywordquery); var resul...

regex - Having an issue with .htaccess mod rewrite assistance appreciated -

thanks in advance help... i creating cms styles , formatting given page dynamically generated depending on type of page (general, member, download,etc.). in past have used following .htaccess identify page type: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l rewriterule ^general/(.*)$ general.php?title=$1 [qsa,l] which works fine required me create rendering page each page type... general.php, member.php, download.php, etc. what trying is... through .htaccess have wild card identify page type have pages render single [page.php] file page types can created on fly without have create rendering page each page type. i having issue $ sign showing in results. know enough .htaccess dangerous... assistance appreciated... this test php <?php $type = $_request['type']; $title = $_request['title']; echo $type.'<br>'.$title; ?> this url: http://my-site.com/g...

javascript - Mobile slide menu scrollable -

i'm using classie.js sliding menu mobile phones site. it's working great! 1 problem: my menu long mobile show menu items @ once. how can make vertical menu scrollable? when scroll while menu open page scrolls. want menu scroll down... hope can me out.. html: <nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1"> <h3> <img id="showleftpush2" src="../images/banner_logo3.png" alt="logo stilld"></h3> <a href="../">home</a> <a href="../portfolio/">portfolio</a> <a href="../testimonials/">testimonials</a> <a href="../blog/">blog</a> <a href="../contact/">contact</a> </nav> <div class="container"> <section class="buttonset"> ...

asp.net - Setting UnobtrusiveValidationMode to None doesn't work -

here go again. another question on microsoft's unobtrusivevalidationmode. so here problem. problem 1 on post back, message shows data submitted.... odd (not on sites) <add key="validationsettings:unobtrusivevalidationmode" value="none"/> to clarify, none means use 4.0 validation , code write database still executed on submit. problem 2 if decide use .net 4.5 validation, jquery loaded when needed. i have ui requires jquery if put scriptmanager in masterpage, jquery loaded twice on form pages so there way either make unobtrusivevalidationmode not process information when set none not have jquery loaded 2x if did unobtrusivevalidationmode on form pages

python - SQLalchemy: alembic bulk_insert() fails -

before flag duplicate: i did take @ question/answer , , did suggests, when add code: permslookup = sa.table('permslookup', sa.column('perms_lookup_id', primary_key=true), sa.column('name', sa.unicode(40), index=true), sa.column('description', sa.text), sa.column('value', sa.numeric(10, 2)), sa.column('ttype', sa.pickletype(), index=true), sa.column('permission', sa.unicode(40), index=true), sa.column('options', sa.pickletype()) ) and run alembic upgrade head , following error: attributeerror: neither 'column' object nor 'comparator' object has attribute 'schema' when examine full stack trace, notice causing error: sa.column('options', sa.pickletype()) this last line of above code... how can resolve this? have not clue how solve it... of kind appreciated. here data want insert: op.bulk_insert('permslookup', [ { ...

java - Failing to print out contents of a file -

i'm trying print out contents of file. when run program, doesn't , i'm having trouble figuring out why. public static void main(string[] args) { string filename = "goog.csv"; file file = new file(filename); try { scanner inputstream = new scanner(file); while(inputstream.hasnext()){ string data = inputstream.next(); system.out.println(data + "***"); } inputstream.close(); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } } need give full path of goog.csv file. put goog.csv file in workspace .metadata directory give full path of file giving output because tried code on system. change goog.csv file mine firmpicture.csv file. public static void main(string[] args) { string filename = "filepath"; file file = new file(filename); try { scanner inputstream = new scanner(fi...

Java MergeSort with Strings -

my teacher out week , gave merge sort code use. written int[]array , supposed make 1 string[]array. here code: public static void mergesort(int[ ] a, int from, int to) { if (from == to) return; int mid = (from + to) / 2; // sort first , second half mergesort(a, from, mid); mergesort(a, mid + 1, to); merge(a, from, mid, to); }// end mergesort public static void merge(int[ ] a, int from, int mid, int to) { int n = - + 1; // size of range merged int[ ] b = new int[n]; // merge both halves temporary array b int i1 = from; // next element consider in first range int i2 = mid + 1; // next element consider in second range int j = 0; // next open position in b // long neither i1 nor i2 past end, move smaller b while (i1 <= mid && i2 <= to) { if (a[i1] < a[i2]) { b[j] = a[i1]; i1++; } else { b[j] = a[i2]; i2++; } j++; } // note 1 of 2 while l...

javascript - JQuery mobile - Use transitions without using changePage -

i using jqm 1.4 , backbone together. in beginning of project, using config file disable jqm router , use backbone 1 instead, called jqm "changepage" method programmatically on hash change. but i've got problems making work want, while need changepage css3 transition. the best option have find way use jquery mobile transitions (slide, pop, fade...) without using changepage. if use transitions on divs, perfect. any clue on how ? know there fine libraries effeckt.css think jqm more mobile-cross-browser compatible (correct me if wrong). animation classes in jquery mobile can found here . use them, need add animation class name e.g. fade plus animation class, either in or out . moreover, make sure remove classes after animation ends listening animationend event. $("element") .addclass("in pop") .one('webkitanimationend mozanimationend msanimationend oanimationend animationend', function () { $(this) ...