Tuesday, 15 January 2013

ruby on rails - Active Admin and instantiating a new object -


I have two tables: events and images

  Events: date name of id name Images: event file captions event_id  

There are several images in an event and an image is related to an event.

My ultimate goal is to upload multiple images simultaneously in the active admin. I have read many other posts suggesting that I do the following:

  class event & Lt; ActiveRecord :: Base has_many: Accepts images: _nested_attributes_for: images mount_uploader: file, avatar tooler end class image & lt; ActiveRecord :: Base is_to: event mount_uploader: File AvatarUploader end  

Then, in my admin / event.rb, I have the following:

  Form Do | F | F.inputs "Event Details" f.input: name f.input: location f.input: date f.has_many: images do | P | P.input: file, as in: = & gt; : File, for: = & gt; [Image. Uncredited] End of End f.actions  

I am able to get visually many image upload fields, the problem is that when I save, the picture is not actually saved Are there. I believe this is because I am not creating any new image on file upload (image.) Is there any way to do this in active admin?

thanks


vb.net - All elements of an array cannot be accessed from a for loop in monthCalendar Control - Visual Basic -


I have an issue here with Month Calendar Controller in Visual Basic. I have a calendar and text box in what is happening in the program. The user selects a date on the calendar, then in the component of the lessons presses the type of information, then the add button. From there, the add button sets a parallel array where the string added from the selected date and text box is a way to add planner information for each date. Then every time such an increase has increased, the date has been bolded for this.

From there, you understand that to click on each bold date and see the information you added. This issue only works on the previous date. For some reason this only reads the last element added in the array. I have a loop below, I do not understand why I can not choose any bold date and add text. I have the option tough so I know that there is no data loss. I also know that the date is being selected and every time when a date is selected on the calendar, the string is placed in it because I am displaying it on the label every time what is the problem. Is this a logical error that I am not holding or is it something else?

  The Public Sub Month Calendar Calendar for 1DateChanged Integer = 0 for 1_DateChanged (As System. Sender, System as E-mail and System.AventRG) Index for Index IntSizeOf Selected Date - 1 strSelectedDay = CStr (Month Calendar Calendar Select Start.) 'Keep the selected date in a string lblError.Text = strSelectedDay lblError.Visible = True Dim strAryDate string = ary as selected date (index) ArySelectedDates (index) = StrSelectedDay) then lblInstruc Tions.Text = strSelectedDay lbl Date selected. Text = aryTextForDates (index) index = intSizeOf selected selected array - 1 end if the next end sub  


windows phone 8 - How To add file to <Assets> folder on WP8 or WP8.1 -


I want to add that file to the folder, after that I added that file, I add that file to the Assets folder In the attempted solution, but unsuccessful, it shows an error box:

  The desired name of "D: \ ....." is invalid  
< P> However I can not add it to the resolved folder.

Do I have to add some stuff to * .xaml first? What is the correct way to add a file to that WP pack it in the last app?

Thank you.

In Solution Explorer, right-click on the Asset folder and select Add.Existing item ... menu option Please. Find the file you want to add and it will be copied to the Assets folder in the solution.

To ensure that it is packed with the app, select the properties of the item in the Solution Explorer and make sure the build action is "content". This will be the default for the common C beginners type (.png, .jpg, etc.) but you have to set it explicitly for other content types.

If you do not want to add a blinded file, you can edit it directly, create a project file or a mapping file and package itself to make the file itself with the Visual Studio instead of the package with the MixPack .


How to unit test pseudo elements? -


I have been told from unit testing that CSS has been implemented properly on my element

However CSS refers to these pseudo elements and as far as I know that they are not part of DOM, there is no access to Javascript and therefore I can not test them.

If this was a system test - I could do a CSS regression test with resemblejs, though I need a unit test implementation

How can I apply it with karma? Am + jasmine + angular combo?

David Walsh is a very good answer for this use

Window.getComputedStyle (domElement, ': first') .getPropertyValue (propertyName);


c# - Need to Include() related entities but no option to do so -


I'm not sure how the title of this question will be, let me explain. I need to select a unit type from my database. It is used to select related institutions, but at the same time select the entities where the unit identifier is equal to one of the IDs in the string array.

My code is as follows:

  list & lt; TSR category & gt; Optional = new list & lt; TSRcategory & gt; (); Foreach (var i.elelectives in client.plit ('& amp;')) {int id = int32.Parse (i); Electives.Add (db.TSRCategories.Find (ID)); }  

This selects TSRCategories properly, which are part of the elective list of ID but does not include related entities. I was using this code:

TSR cognition = dbtrs Categories Include ("Capabilities Capabilities Skills"). ToList ();

But it does not select the selected electives only. What I'm ideally looking for is something like this:

  list & lt; TSRcategory & gt; Optional = new list & lt; TSRcategory & gt; (); Foreach (var i.elelectives in client.plit ('& amp;')) {int id = int32.Parse (i); Electives.Add (db.TSRCategories.Find (ID)); } TSRCategories = Electives. Include ("Competencies.CompetencySkills"). ToList ();  

But of course it can not be done for any reason (I really do not know why this can not be done online in case of searching!). Electives is a string that contains & amp; Separating the IDs in the form of delimiters involves competencies in the category of TSR, including competing skills. Is there really a way to do it effectively and in some lines?

You will find that the affiliate ID will result in a bad query display after a second You can get them once presenting the list (I have assumed the key name here: ElectiveId ):

  var selectiveIds = Client.Electives.Split ('& Amp; ') Select (i = & gt; Int32.Parse (i)) .oire (); Var optional = db.TSRCategories. Include (T = & gt; T. Competition. Select (C = & gt; C. Compensation Skills)). Where (SSR => electives: canteen (SSR.acciliid). Ollist ();  

But one thing to mention is that your id is associated with a delimiter in a string field that is a violation of database normalization instead, instead of using a new junction Create a table, e.g. ClientElectitions , which is a generalized fashion with optional clients associated with a client (ClientId, Elective ID) . It will also simplify your EF recovery code.

Edit

According to the examples, I should use . Select for depth specification of curious loading (no . Many selects or other extension methods).


cryptography - Why does the security of RSA depend on the non-factorability of the modulus n? -


Just wondering why RSA's security depends on the non-causality of the modulus?

Cheers!

Good ... The non-causality of the modulus n is not the whole story ..

As vlad has already told, if you know the factors of n, you can easily calculate personal exponent ...

(p-1) (Q-1) .. or in general ... If you know the main factor of p number [i], then you can calculate the product of all (pi [ii] - 1). Which is the PHI function ajar ... to know the number of mutual qualitative elements, nn

If you can factor to n, then this calculation becomes trivial. Yes ... if n consists only 2 large prime, and this coefficient is hard, it is not really trivial ...

However ... if you calculate PHI (N) Come up with any other idea ... the number of elements, which is a qualitative reciprocity ... the factorization wou Ld is probably not your problem anymore ...

Currently there are no other public There is no known method, such as the method of eels ... prod (p [i] - 1)

either PHI (n) To find a way to classify, or calculate in a different way, possibly going to be RSA breaker


c# - How to add 2 value of dictionary inside a list of an object -


मेरे पास एक ऐसा वर्ग है:

  वर्ग आइटम {सार्वजनिक इन्ट आईडी}; सेट; } सार्वजनिक शब्दकोश & lt; स्ट्रिंग, इंट & gt; डेटा {प्राप्त; सेट; }}  

और मेरे पास 2 लिस्ट में उस श्रेणी के ऑब्जेक्ट शामिल हैं:

  आइटम obj1 = new item (); Obj1.Id = 1; Obj1.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj1.Data.Add ("1", 11); Obj1.Data.Add ("2", 12); Obj1.Data.Add ("3", 13); आइटम obj2 = नया आइटम (); Obj2.Id = 2; Obj2.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj2.Data.Add ("1", 21); Obj2.Data.Add ("2", 22); Obj2.Data.Add ("3", 23); आइटम obj3 = नया आइटम (); Obj3.Id = 3; Obj3.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj3.डेटा। जोड़ें ("1", 31); Obj3.Data.Add ("2", 32); Obj3.डेटा। जोड़ें ("3", 33); आइटम obj4 = नया आइटम (); Obj4.Id = 1; Obj4.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj4.Data.Add ("1", 41); Obj4.Data.Add ("2", 42); Obj4.Data.Add ("3", 43); आइटम obj5 = नया आइटम (); Obj5.Id = 2; Obj5.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj5.Data.Add ("1", 51); Obj5.डेटा। जोड़ें ("2", 52); Obj5.Data.Add ("3", 53); आइटम obj6 = नया आइटम (); Obj6.Id = 3; Obj6.Data = नया शब्दकोश & lt; स्ट्रिंग, int & gt; (); Obj6.Data.Add ("1", 61); Obj6.Data.Add ("2", 62); Obj6.Data.Add ("3", 63); सूची के & lt; आइटम & gt; Lst1 = नई सूची & lt; आइटम & gt; (); lst1.Add (obj1); lst1.Add (obj2); lst1.Add (obj3); सूची के & lt; आइटम & gt; Lst2 = नई सूची & lt; item & gt; (); lst2.Add (obj4); lst2.Add (obj5); lst2.Add (obj6);  

अब मैं वस्तु के आईडी और शब्दकोश कुंजी के आधार पर शब्दकोश के मूल्य को जोड़ना चाहता हूँ। परिणाम इस तरह होगा:

  सूची & lt; आइटम & gt; परिणाम = नई सूची & lt; आइटम & gt; (); परिणाम [0] .आईडी = 1 का परिणाम [0] .डेटा ["1"] = 52 // obj1.डेटा [1] + obj4.Data [1] परिणाम [0] .डेटा ["2"] = 54 / / Obj1.Data [2] + obj4.Data [2] परिणाम [0] .डेटा ["3"] = 56 / obj1.डेटा [3] + obj4.Data [3] परिणाम [1] .Id = 2 परिणाम [1] .डेटा ["1"] = 72 / obj2.डेटा [1] + obj5.डेटा [1] परिणाम [1] .डेटा ["2"] = 74 / obj2.डेटा [2] + Obj5.Data [2] परिणाम [1] .डेटा ["3"] = 76 / obj2। डेटा [3] + obj5.डेटा [3] परिणाम [2] .आईडी = 3 परिणाम [2] .डेटा [" 1 "] = 92 / obj3.Data [1] + obj6.Data [1] परिणाम [2] .डेटा [" 2 "] = 94 / obj3.डेटा [2] + obj6.डेटा [2] परिणाम [ 2] .डेटा ["3"] = 96 / obj3.डेटा [3] + obj6.Data [3]  

यह परिणाम प्राप्त करने का सबसे अच्छा तरीका क्या है?

धन्यवाद

सबसे पहले, आप एक उदाहरण के रूप में दिखाया गया आउटपुट गलत है। उदाहरण के लिए, obj3.Data [1] + obj6.Data [1] बराबर 92 , 56 नहीं।

तो, यह यहां के साथ है LINQ के सभी सौंदर्य:

  var परिणाम = lst1.जोइंड (lst2, x = & gt; x.Id, y = & gt; y.Id, (x) , Y) = & gt; नया आइटम {आईडी = x.Id, डेटा = x.डेटा .जोइंड (y.Data, a = & gt; a.Key, b = & gt; बी.केए, (ए, बी) = & gt ; New {a.key, value = a.value + b.value})। ToDictionary (r = & gt; r.key, t = & gt; t.value}})। ToList ();  

आप चाहते हैं, परिणाम यह है:

  परिणाम [0] .आईडी = 1 परिणाम [0] .डेटा ["1"] = 52 // obj1.Data [1] + obj4.Data [1] परिणाम [0] .डेटा ["2"] = 54 / obj1.डेटा [2] + obj4.Data [2] परिणाम [0] .डेटा [ "3"] = 56 / obj1.Data [3] + obj4.Data [3] परिणाम [1] .आईडी = 2 परिणाम [1] .डेटा ["1"] = 72 / obj2.डेटा [1] + Obj5.Data [1] परिणाम [1] .डेटा ["2"] = 74 / obj2.डेटा [2] + obj5.डेटा [2] परिणाम [1] .डेटा ["3"] = 76 // Obj2.Data [3] + obj5.Data [3] परिणाम [2] .Id = 3 परिणाम [2] .डेटा ["1"] = 92 / obj3.डेटा [1] + obj6.डेटा [1] परिणाम [2] .डेटा ["2"] = 94 / obj3.डेटा [2] + obj6.डेटा [2] परिणाम [2] .डेटा ["3"] = 96 / obj3.डेटा [3] + obj6 .डेटा [3]  

mac spoofing - How to select vendor when using macchanger in linux -


Currently, I'm using this command to trick my MAC address:

Macchanger eth0-A

However, I want to be able to use that vendor I know that Switch-L displays a list of all available vendors, but says that I I want to use it, instead of selecting random seller for me every time that special Which command do I use to use vendor?

You can add a function like this .bashrc Then you can: MacSPOP Apple ethyl < / P>

 McSpop () {seller = $ (buyer- l | grep $ 1 | shuff-n 1 | awk '{print $ 3}') Tell = $ (echo $ Random | MD5 esum | SAD / .2 \} / & amp ;: / g 'cut -c 1-8) Mac = "$ vendor: $ tail" sudo macchanger -m $ mac 2 $}  

ssl - WebSphereMQ with HermesJMS -


I use WebSphereMQ v7.1 and HermesJMS v1.14 SoapUI. I set up everything to connect these apps without SSL and they work fine. The problem is, when I try to connect to SSL. I set at parameters:

  SSLCipherSuite: SSL_RSA_WITH_3DES_EDE_CBC_SHA channel, hostname, port, queueManager, transportType: 1  

And I trustStore and keystore in hermes.bat Added. In WMQ I have set up: TRIPLE_DES_SHA_US on this page-on-channel> I see that I know CipherSpec and CipherSuite match right.

What's wrong?

Update

down error Hermes

  because: com.ibm.mq.jmqi.JmqiException: Cc = 2; RC = 2397; AMQ9641: Remote CipherSpec error for channel 'CHANNEL1' [3 = CHANNEL1] com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.analyseErrorSegment (RemoteConnection.java:4322) on com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.receiveTSH (on RemoteConnection Java 2902) in com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.initSess (RemoteConnection.java:1440) on com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.connect (RemoteConnection Java : 1115) com.ibm.mq.jmqi.remote.internal.system.RemoteConnectionPool.getConnection (RemoteConnectionPool.java:350) on com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect (on RemoteFAP.java: 1599 )  

> I know that the solution to this problem - on this page:

Make sure that you set on the client matches a cipher suite Qi Management Server connection cipher space channel.

But as I mentioned before, I have correctly matched cipherspec and ciphersuit.

What are you using an Oracle JRE / JDK? I had only one issue and written about it here:

The easiest solution is to use IBM's JRE / JDK.


scala - spray-testkit === status passes whatever status is -


I have the following test spray testkit with scalatest and I do not understand why it passes every time regardless of the actual test conditions.

  import akka.actor._ import akka.event.LoggingReceive import akka.testkit.TestProbe import com.ss.rg.service.ad.AdImporterServiceActor. {GetImportStatus, StatusOfImport} import org.scalatest. {MustMatchers, WordSpecLike} import spray.http._ import spray.testkit.ScalatestRouteTest sq WordSpecLike with MustMatchers with AdServiceApiTest ScalatestRouteTest { "AdService REST API" { "should be post processed for imports with mandatory standards should" {val P = in TestProbe () Val addressServiceMock = system.actorOf (props (classOf [AdServiceActorMock], p.ref)) post ( "/ service / ad / import? AdId = 1") ~ & gt; New AdServiceApi (Address Service Mark) Root ~> Investigation should be handled (correct) // Disclaimer size must be 1 response.status === StatusCodes.NotAcceptable}}}  

Test passes even if that condition should be different and when I made failed to justify testing rejection ... error message is as follows:

  request was rejected, the response was HttpResponse (202 accepted, HttpEntity ( Text / plain; charset = UTF-8, has been accepted for the request process, but the process Riya is not fulfilled), list (), http / 1.1) org.scalatest.exceptions.TestFailedException:. HttpResponse request was rejected, the response has been had (202 accepted approved, HttpEntity (text / request for plain; charset = UTF-8, processing, but the processing has not been completed.), List (); HTTP / 1.1) spray testkit.ScalatestInterface $ class.failTest (ScalatestInterface.scala: 25)  

It seems that I am missing some important concept.

Can anyone explain?

Update: Working correctly

  the status should be equal (StatusCodes.Accepted)  

=== is not enough you have to write

  status === (Status dot non-attachable)  

or

  emphasize (status === conditioncode.no. can not be counted)  

python - how to split a dataset into training and validation set keeping ratio between classes? -


I have a multi-classification problem and my dataset is slant, I have 100 examples of a particular class and some of them 10 different classes, so I want to divide the ratio of maintaining my datasets between classes, if I have 100 examples of a particular class and I have to record 30% of the training, then I want my 100 records 30 examples of representation squares and mer Like 10 represent three examples classes of records and so on.

You can use scalarse from online docs:

Stratified K-folds cross-resolution iterator

Train / test indicator provides information for splitting data into test tests.

This is a variation of the cross-audition object's fault, which returns the returned values. Silvets are formed by preserving the percentage of samples of each class.

  & gt; & Gt; & Gt; Cross_validation from sklearn import & gt; & Gt; & Gt; X = NP Array ([[1, 2], [3, 4], [1, 2], [3, 4]]) gt; & Gt; & Gt; Y = np.array ([0, 0, 1, 1]) & gt; & Gt; & Gt; Skf = cross_validation.StratifiedKFold (y, n_folds = 2) & gt; & Gt; & Gt; Lane (SkaF) 2> gt; & Gt; & Gt; Print (skf) sklearn.cross_validation.StratifiedKFold (label = [0 0 1 1], n_folds = 2, shuffle = false, random_state = none)> gt; & Gt; & Gt; For train_index, in test_index skf: ... print ("train:", train_index, "test:", test_index) ... X_train, X_test = X [train_index], x [test_index] ... y_train, y_test = Y [Train_index], y [test_index] Train: [1 3] Exam: [0 2] Train: [0] Exam: [1 3]  

This is the ratio of your class to Will preserve that the division maintains the ratio of the square, this pandus will work fine with DFS.

As suggested by @eli_m, you can use which accepts a different ratios paragraph:

sss = StratifiedShuffleSplit (y, 3, test_size = 0.7, random_state = 0)

will produce a 70% segmentation.


Monaca: How to share an app with testers on the Basic plan? -


Monaco says that the basic plan allows users to join as a tester in a project to invite. However, I can not get a doc to do this, and by clicking on the Share Project return, "Please upgrade your plan to use this feature."

Is there any way to share an app with testers without upgrading to a paid plan?

I suppose you misunderstood as described in the documentation,

However, if your usage plan is basic or personal, then you can chat with only one team and join as a tester

As a tester You can join but you can not share a project. In other words, you can be invited to join a project as a tester. There is no team management facility in individual or original account (please share projects and invite people in projects) Please see


survey - How to do "Weight by..." (SPSS function) in R? ... trying to weigh Likert Scale responses -


Resolved ... short

< P> So, I did not find an exact function / package to fix it, but I thought someone on reddit had said about having the frequency number .... and so I get a dumber way to get the calculation found it. I reduced the data based on the required lintoret values ​​and then I ran an amount (x) / zodiac (all) function, where x is the subset and all the weight is the sum of ... and the numbers were checked out Kindly know that this is ugly code ... but I think what weight is doing and I can think of optimizing it with other things which I am in R.


My boss asked me to help some surveys to see the data, but I do not have an additional SPSS or State License to run on the computer. I can not show it how to do this with my setup. . Instead, try "Allow me" to download R and try it.

I know that the SPSS has a "get by ..." option, and you choose the column with weight and POF ... then you do all your calculations.

I'm trying to figure out how to do this, and I'm reading the weight package and survey package.

The first calculation I need to run is a lecture scale column and my weight vectors are these large numbers: 121958 125463 99638 125463 102539 181061 126367 125463

The form of part of the interview process I used to test a figure, and they used me for SPSS and then I just applied the weight ... I do not remember, but I think that according to the analysis of LICTS, SPSS was very easy.

They want (as a%) lot and extremely / total responses ....

It is not helping to say that I am about this internship I'm worried. My boss gave a sound like they actually tried me and doing something with the data made me realize one thing, but they do not know how to program in R and they have some open with SPSS or State There are no seats, which they know how to use ... so that they can not really give me any direction about fulfilling this. ... and of course he said, "Do not worry, we do not need you ..." But I'm dying to do something in this internship, and I really want to know how to do this ... I do not know how to find out how to do it.

I saw it on the stack overflow, but seeing the xtabs help files also can not find any way to apply to my data file. I tried this code

Xtabs (weight ~ FWGT, data = data2)

error in as.data.frame.default (data, xtabs (weight ~ FWGT, data2 = df) ) 0

My weight is vector < Error (expr, envir, enclos): object 'weight' and my data set data2 / Code>

the feet here When I searched around the stack overflow:

I will write in SPSS

weight by weight.

and after that order the data will be weighed according to all the processes

xtabs (weight ~ UH6401, data = df)

/ div>

< You can find the document here

P>

div>

SingularityGS: How to code float-span variations with breakpoints? -


I have a Float-Spanish layout that has several tiles in the 12 column grid, on breakpoints 600px me this float-spain (2 ) And I want float-span (4) at 1024px.

I think the small breakpoint layout has been displayed but the big breakpoint layout is broken and the nth-child value seems to be inherited from the lower breakpoint.

That is my essence

What am I doing wrong?

See

/ P> P>

Changing Data Types in Javascript -


I is a new brand for javascript, and is relatively new to programming in a complete form. I understand javascript mechanics, but I have been stumped in a situation like the following:

  var dataTypes = {string1: "test", string2: "test", number1: 4,}; Console.log (type of data types.number1); Console.log (""); (For data type var x) {console.log (typef x); If ((typef x) === "string") {console.log (data type [x]); } Else {//}}  

And when I run it, my console displays the following:

  number string string test string 4 < / Code> 

How confused I am that how dataTypes.number1 goes into a string with the number of data types, if any time elapses to take what I do To do this, and to explain, it will be amazing.

Your variable is different from the x key value, which Each key / value pair is related to data type . So it's always a string.

You need to check the type types data type [x] instead.


java - Using the MockDataProvider of JOOQ, how do I set the lastId() that gets returned? -


Note: I am not using jooq's code generator

  DSLContext ctx = DSL.using (no actual database has been contacted because I am using the MOCKONNICATION and MOCKETPROVIDER JOOQ.  

connection, SQLDialect.MYSQL); // Insert // Find Bigger ID = Ctx list ();

JOOQ performs the following query:

  last_insert_id () Select Dual;  

In my MockDataProvider I check when this query is executed and returns the result accordingly:

  import static org.jooq.impl.DSL Dual; // Execute another code @ Override public Mok Result [] (MockXtequettentex CTX) throws SQL Consection {field & lt; Bigenter & gt; Id = DSL.field ("", BigInteger.Class); Record record = dual () NewRecord (); Record.setValue (id, BigInterview.auview (1234567)); Return the new Mock Result [] (New MockScult (record)}}  

The above MockResult is back, so I get the following exception

  java .lang.IllegalArgumentException: field () is not included in the line  

What is the correct way to populate the MockResult for the query (last_insert_id)?

This is an implementation implementation for MockDataProvider for DSLContext.lastID () :

  Expect BigInteger = BigInteger valueOf (1234567); DSLContext ct X = DSL.using (new mock connection (c -> gt; field & lt; bigenter & gt; id = DSL.field ("last_insert_id ()", BigInteger.class); record record = DSL.using (MYSQL) Newrecord (ID); Record. Set Value (ID, Expected); New Mock Result [] (New Mockeryzalt (Record)}}), SQLEact.MYSQL; AssertEquals (Expected, ctx.lastID ());  

There are essentially two things that have gone wrong in your view:

Field Name

Field name of the field that you are choosing In essence, it is called last_insert_id () (at least jOOQ 3.5.3), so you have to give your duplicate field a name like this:

  Field & lt; BigInteger & gt; Id = DSL.field ("last_insert_id ()", BigInteger.Class);  

record

You will have to create that record in which it already has your field. There is a separate area in the table. The fact that jooq generates a dual query is irrelevant to the fact that you record in which the last_insert_id () field is:

record record = DSL.USING (MISSQL). Newrecard (ID);

Warning

Of course, you are making a strong assumption about the implementation of Joaqu's because it is in 3.5.3. There is no guarantee that exact query generated by DSLContext.lastID () should always be

  last_insert_id () select double  

field name in forms must match model attribute names in RAILS 4? -


क्या रेल हमेशा फॉर्म कोड में name = "example" का उपयोग करते हुए मॉडल विशेषता नाम को मैप करते हैं?

इसका अर्थ है कि फार्म फ़ील्ड पर नाम विशेषता हमेशा डब कॉलम नाम से सख्ती से मेल खाती है जिसे ActiveRecord मॉडल को मैप किया जाता है?

उदाहरण के लिए, मेरे कोड में

  & lt;% = form_for (@ प्रॉपर्टी,: url = & gt; लैंडलॉर्ड_प्रॉपर्टीज़_पाथ (वर्तमान_landlord) ,: html = & gt; class = & Gt; 'फार्म-क्षैतिज'}) करना | च | & Gt%; & Lt;% = रेंडर 'shared / error_messages', ऑब्जेक्ट: f.object% & gt; & Lt; div वर्ग = "फॉर्म-समूह चयन संपत्ति प्रकार" & gt; & Lt;% = f.text_field: स्थानीयता, 'नाम' = & gt; "स्थानीयता"% & gt; & Lt;% = f.text_field: देश, 'नाम' = & gt; "administrative_area_level_1"% & gt; & Lt;% = f.submit "जोड़ें", वर्ग: "बीटीएन बीटीएन-एस-एमडी बीटीएन-सफलता पुल-दायें"% & gt; & Lt;% end% & gt;  

मेरे एआर नामक एक विशेषता है: स्थानीयता जो मेरे डीबी कॉलम नाम से मेल खाती है: स्थानीयता

मुझे भी एक और विशेषता है: देश, लेकिन क्योंकि इस रूप में , ऐसा नाम ऐसा लगता है कि डेटा को एआर के माध्यम से पारित नहीं किया जा रहा है

मैं इस नाम को ओवरराइड कर रहा हूं क्योंकि मैं उपयोग कर रहा हूं भौगोलिक, और उन नाम क्षेत्रों का उपयोग Google मानचित्र एपीआई कॉल करने के लिए किया जाता है। 'name' = & gt; "administrative_area_level_1" वास्तव में डेटाबेस में होना सुविधाजनक नहीं है

पूर्व>

यह वर्तमान में काम नहीं करता है, कोई भी मूल्य इनके पास नहीं है: देश

अगर मैं : administrative_area_level_1 को params.permit में जोड़ता हूं, तो रेल शिकायत

< <> अज्ञात विशेषता: administrative_area_level_1

जो मुझे अनुमान लगाना है क्योंकि यह मेरे डीबी में नहीं है।

क्या मेरे लिए नक्शा < कोड> नाम = प्रशासनिक_रेरा_लेवल_1 फ़ील्ड से: मेरे ऐप में देश का कॉलम?

अपने मॉडल में आप निम्न विधि को परिभाषित कर सकते हैं:

  def administrative_area_level_1 = (इनपुट) self.country = इनपुट # या जो भी आप देश अंत में इसे नक्शा करने के लिए इनपुट के साथ करना चाहते हैं   

sql - Database connection not permanent saving -


I am using Visual Basic Express 2010, and I have made a connection to the database I created when I Use nothing on the first hand, wrong I can see the data I use to put in my database program and the data is also in my database itself, but when I close the footage basic and after a few days all my databases Look my last date Has disappeared, so my data to make it simple to save permanently and now do I know this because I use datasets that have an offline database connection. And now my question is, can I change my code so that when I click on 'Save' then is actually saved in my database and does not disappear in a few days?

  public class KlantToevoegen Private Sub KlantBindingNavigatorSaveItem_Click (ByVal as the System.Object, ByVal e System.EventArgs) as handle KlantBindingNavigatorSaveItem.Click so TbGemeente: My code (a few things bout sorry In Dutch) .text = "" or TbPostcode.Text = "" or TbAdres.Text = "" or TbVoornaam.Text = "" or TbNaam.Text = "" then MsgBox ("Update failed!") Otherwise Me Validate () my Manage KlantBindingSource.EndEdit () Me.TableAdapterManager.UpdateAll (Me.PowerShotKassaBonDataSet) MsgBox ( "Update successful happened") ending End Sub Private Sub KlantToevoegen_Load (ByVal as from System.Object, as ByVal e System.EventArgs) Does MyBase.Load me KlantTableAdapter.Fill (Me.PowerShotKassaBonDataSet.Klant) end sub-private sub-TbGemeente_Text (TBGemeente.TextChanged) as TBGemeente.Text = "" handles as .View EventArgs in the form of Byval Sender System, as the system. Then "Me.ErrInvullen.SetError" (Me. TBGMETE, "Jiff de Gimentant in.") Or else Me.ErrInvullen.SetError (Me.TbGemeente, "") End End Sub Sub-Private Sub TbPostcode_TextChanged (as System.Object, as E. System.EventArgs) TbPostcode.TextChanged does not have IsNumeric (Me.TbPostcode.Text) then Me.ErrInvullen.SetError (Me.TbPostcode, "Postcode in Geef een (right).") TbPostcode.Text = "" Me.ErrInvullen.SetError (Me.TbPostcode, "") End If TbPostcode.Text.ToString. Langs & gt; 4 And TbPostcode.Text = "" Me.ErrInvullen.SetError (Me.TbPostcode, "Geef een correct postcode.") Geef een correct postcode in MsgBox ( ".") End If End Sub Private Sub TbAdres_TextChanged (this System.Object TbAdres.Text = "so, TbAdres.TextChanged handles e System.EventArgs)" then Me.ErrInvullen.SetError (Me.TbAdres, "Geef het know.") Otherwise Me.ErrInvullen.SetError (Me .TbAdres, "") end end sub manages private sub TbVoornaam_TextChanged (as in this System.Object, e System.EventArgs) TbVoornaam.TextChanged so TbVoornaam.Text = "" or IsNumeric (Me.TbVoornaam. Text) Then Me.ErrInvullen.SetError (me.TbVoornaam, "Geef een Voornaam.") Or else Me.ErrInvullen.SetError (Me .TbVoornaam, "") End End Sub Private Sub TbNaam_TextChanged (such as System.Object, manages e System.EventArgs) TbNaam.TextChanged so TbNaam .text = "" or IsNumeric (Me.TbNaam. Text then Me.ErrInvullen.SetError (Me.TbNaam, "Geef een name.") Or else Me.ErrInvullen.SetError (Me.TbNaam, "") end then End Sub Ending Class  
< / Div>


c# - How does PowerBuilder handle sql server connection? -


In PowerBuilder, you do not need to send connstring to any sql CRUD, how does he do it?

And it is good to send SQL Converting to any SQL command (CRUD, KON)

Hopefully

When you connect, the connection string is passed in sqlca.DBParm. When you call the update function on the data window, it automatically sends updates / updates / delete / INSERT SQL statement to the database.

Have you used PowerBuilder before? This is very basic stuff. In the future, please specify the PowerBuilder version and whether you have PowerBuilder. Using net or classic.


javascript - Regex to remove string after last number? -


There are so many regexs but I could not find a solution to my specific problem.

Look at these stars:

  My road 13a mystreet 3 B My street colosse 15a  

How do I make those people Can return:

 <13> matches with "13A, 13A" and  \ "\"  My street 13 mystreet 3 My road karlos 15  

\ d + [az, az] D + [az, az] it matches white spots, then I use it: / P>

  myCutStr = myOriginalString.match (/ \ d + [az, a-za] / g); MyNewStr = myCutStr.replace (/ [^ \ d] / g, ''); MyOriginalString.replace (myCutStr, myNewStr);  

But can I add \ d + [a-z, A-Z] in any way and ignore white spaces in that regEx? So that it will also match with one of the white areas of my \ d + [az, az] ?

The place of one place would be enough, that is, all the non-digit characters with all empty strings place.

  string.replace (/ \ D + $ / g, '');  

OR

  string.replace (/ (\ d) \ D + $ / g, '$ 1');  


ajax - Given that you could make cURL requests, what does the same-origin policy actually protect against? -


I think I understand what this is. It says that scripts and AJAX requests should come from the same root, which means they should have the same protocol, host, domain and port.

What I do not understand really protects against it. For example, say we have two sites: attacker.com and bank.com. I think the attacker.com can not have a script or the AJAX requests are used by the bank.

  • You can use

    These things Looking at, how does the same basic policy actually protect?

  • There is no security issue when you send your own request to the bank, then curl Or use your browser. There is no attacker in these scenarios, just you and the bank.

    When we go to the attacker and it is unaware of you, then it requests the bank Your browser, which logs at bank.com These may be.

    The same-basic policy prevents the owner of the attacker.com from requesting the bank using your browser


    python - NumbaPro JIT a class constructor -


    I'm looking for a way to use JIT for the creator of Python class:

    < Import from NMP as NMP in the form of NPP as the NPP, Automated by Time Import Time Class (object): @ win (float, float, float), target = "CPU") def __int __ (self) , X, y, z): self._x = x self._y = y self._z = z @autojit def runTest (self): n = 1000000 self. _z = 0 in xrange (n): self._z = self._z + np.sin (i) returns self._ if __name__ == '__main__': a = test (4,5,6) start_time = time ( ) Z = a.runTest () end_time = time () # Get printout of CPU time ("Math time: {0} s" .format (end_time - start_time)) print z

    However, it seems that I have to give a type for self , which I do not know how to get it.
    Maybe someone knows how to get it?

    Thank you in advance - Andi

    There was support for "jitting" classes Version 0.12 Removed from numba from:. This is called 'extension type', but nowadays all related examples do not work: TypeError: 'NotImplementedType' object is not callable if executed with the current release (0.17).

    So I suggest firmly that you take the runTest functionality to your own function, and that you have the data in that function Use or pass, because those mechanisms are supported Otherwise, you are stuck in using the old versions of Amba.

      class test: def __init __ (self, x, y, z): self.x = x self.y = y self.z = z @jit (float (float) )) Def runTest (z): n = 1000000 z = 0 in i xrange (n): z = z + np.sin (i) returns z if __name__ == '__main__': a = test (4,5,6) ) Start_time = time () z = runTest (az) end_time = time () # get printout of CPU time ("Math time: {0} s" .format (end_time) - start_time)) print z  < / Pre> 

    ruby - Using model attribute as :filename when using paperclip gem -


    There is an error in changing me: The file name of my paperclip attachment is equal to one attribute on class I, IM, the paperclip Attaching the file.

    When I use "# {self.company_name}", these errors occur. I obviously do not have the "self" company in this area, when I wrote this line, then I assumed that The company's example is that I am uploading this attachment. Any idea how I can fix this? Paperclip Docs says that use ": file name" but I want to use the value of Company.company_name instead.

      class company & lt; ActiveRecord :: Alliance Attains status_file in Base: company_logo, {: storage = & gt; : FTP ,: path = & gt; "/logos/#{self.company_name}" ,: url = & gt; FTP_CONFIG [: access_host] + "Logo /: file name",: ftp_servers => [[Host = & gt; FTP_CONFIG [: Host] ,: User = & gt; FTP_CONFIG [: User],: Password = & gt; FTP_CONFIG [: Pass],: Port = & gt; 21 # Optional, 21}}  

    Update by default

    I tried to use the advice found in this post:

    But now I am getting the following error when my server starts:

      Undefined method paperclip: Attachment: class (nomeless error)  

    It seems that the syntax for interpolations has changed. Updated it and it worked. Add the following to your model or create a paperclip .bb file in config / initializers

      paperclip.in Republaces: Company_name. Enclosure, Style | Attachment.instance.company_name termination  

    c# - Accessing Connection Received IP -


    I'm struggling with something that might be really simple but goes here.

    I have a method named Runerver, everything is working in it. I have another method which is called logquestion. I want to be able to use a variable set within the runover. What would be the best way?

      Fixed zero runServer () {// Everything is working here, but I want to use the variable / function: string clientIP = connection.RemoteEndPoint.ToString (); } Fixed zero logRequest () {// What I want to do is the string that I created in runServer and use it here. Console.WriteLine (clientIP); } I have debuged it and it is working fine it gives an IP address but I want to be able to print that IP address on the console. Runsarvers include bus TCP listener, etc. Basic code for running the server. What I want to do is use that string within that method.  

    I can not really take the variable client to that method, as is the connection.

      Fixed zero run server (TcpListener listener); Socket connection; Networkstream socket stream; {Listener = Try New TcpListener (IPADres.ne., 43); Listener.Start (); Console.light line ("server started listening."); While (true) {connection = listener.acceptsocket (); String client IP = connection.RemoteEndPoint.ToString (); SocketStream = new network stream (connection); DoRequest (socketStream); SocketStream.Close (); Connection.Close (); }} Hold (exception e) {Console.WriteLine ("exception:" + e.ToString ()); }}  


    active directory - LDAP Users not visible in the Manage Users in the WebSphere admin console -


    IBM is the WAS 8.5 test version in Windows 7 and I have installed the MS Active Directory with the original DN on the same machine DC = SSO, DC = PACS, DC = TEMENOS and I have a user friendly Formed as DN as "CN = Manohar, OU = user, DC = SSO, DC = PACS, DC = TEMENOS" and "Temenos17" Password

    With Manohar I became another user A T24User1 & amp; In the form of T24User2 with parent DN, I created a federated repository in the OU = user, DC = SSO, DC = PACS, DC = TEMENOS

    Created MS AD I have configured all AD details to be properly displayed. I'm able to login to WAS Console with a lovely user. When I try to list users in the WAS with "Manage Users" link, no single user is showing and at the same time showing all groups from the "Manage Groups" link

    < P> Please help me in my list of all my Active Directory users in my WAS console.


    java - setPluginsEnabled(true) and setPluginState(WebSettings.PluginState) deprecated, what should i do? -


    itemprop = "text">

    This code works fine since I updated the API1 and set the plugin to enable plugins (true) type webseat Has now been deprecated. / P>

    Set the method that I had to face PluginState.ON will be a solution but it has also been deprecated.

    What could I do? I found these posts, that there are problems similar to some people, but did not help me in those answers: / Although the compiler gives me a warning, it successfully compiled (This is the reason why it is being disliked, but it Not just yet. Set with the plugin plugin enabled, am I right?)

    What should I really do, it displays a graphic chart that sells data by loading DB Private Zero Update ChartDataSet () {enumeration & lt; Integer & gt; Enumerator = this.values.keys (); While (Calculator HS Other Elements ()) {Integer key = Enumerator. NXtaille (); Double value = this.values.get (key); This.diasJsonArray.put (dateUtils.convertGraficoVentasMensualDateToString (dateValues.get (key)); This.montosJsonArray.put (value); }} Private Zero SetWeb Videedia () {this.webView.getSettings () SetJavaScriptEnabled (true); . This.webView.getSettings () setBuiltInZoomControls (true); This.webView.getSettings () setPluginsEnabled (true). This.webView.addJavascriptInterface (New GraficoWebAppInterface (diasJsonArray, montosJsonArray, "Ventas Mensual", "Venta del día"), "Dataloader"); This.webView.loadUrl ("File: ///android_asset/charts/VentasClientes/chart.html"); This.webView.setWebViewClient (New WebViewClient () {@Override Public Boolean Shoulder Override URL Loading (WebView View, String URL) {return false;}};

    android_asset / charts / ventasClientes / chart.html:

      & lt; Script src = "jQuery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "highcharts.js" & gt; & Lt; / Script & gt; & Lt; Div id = "container" style = "minimum-width: 400px; height: 400px; margin: 0 auto" & gt; & Lt; / Div & gt; & Lt; Script & gt; $ (Function () {$ ('# container'). High Chart ({chart: {type: 'bar'}, title: {text: dataLoader.getTittle ()}, XXIS: {categories: eval (dataLoader.getCategories ( }, Title: {text: null}}, yAxis: {min: 0, title: {text: 'monto ($)', align: 'high'}, label: {overflow: 'justify'}}, tooltip: {ValueSuffix: '$'}, plot options: {time: {dataLabels: {enable: true}}}, legend: {layout: 'vertical', align: 'right' vertical alliance: 'top', X: 100, Y: 100, Floating: True, Threshold Width: 1, Background Color: '#FFFFFF', Shadow: True}, Credit: {Enabled: Episode: [{Name: dataLoader .getSerie (), Data: eval (dataLoader.getData ())}]})}}); & lt; / script>  
    < / Div>


    c++ - QT menubar action reciver cusom class -


    I have the menu bar, when you create a new project and I have triggers () and set all senders I want to have the signal to be sent to a custom class. I have 3 static functions / slots in the class, but none of them are visible in the list.

      #ifndef CONTENT_H #define CONTENT_H # include & lt; QString & gt; # Include & lt; QObject & gt; Classroom Content: Public QObject {Q_OBJECT Public: QString filePath; material(); Public slot: Save static zero (content content, Qustring filepath); Static Content Load (Qestring FilePath); Static content new (); }; #endif // CONTENT_H  

    Designer to connect signal and slot only between standard QT widgets , And those widgets that make them subclass. Here's a great example you'll have to use in the source:


    internet explorer - IE and Mixed content -


    I have a problem facing a public website on which we are working.

    Reference:
    The website is served on HTTP, and each page has an iframe which is served on HTTPS . The website also uses the required.js as a module loader.

    Problem: However, the "normal" (included in HTML) script loads properly on HTTP, throwing dynamic scripts SEC7111 loaded by Require.js : HTTP file path on IT & gt; has been compromised with HTTPS security, no matter what version.

    As a result, users are presented with this message:
    IE notification message

    Yes, users can click on the Show all content button to force JS files to load, but the experience is useless.

    Note:

    • The scripts that throw error are related to the main page, and iframe
    • < Li> The problem is clearly related to the safe iframe if the page has been removed, the errors have disappeared
    • The problem is not present on Firefox or Chrome.
    • Question:

      • Do anyone know that IE complains about JS files that HTTP Has been served on?
      • Does anyone have a solution, so the user has not been presented with the message and all the scripts are loaded without user without any other action?
      • A trick is "fix" which is specified in the IE team to deal with mixed content. :

        Specify the source of the page's resources using form-related hyperlinks, for example "// example .com / image.gif". When a user visits such a secure page in which such reference (eg.) Will result in evaluation of the URI. On the other hand, if the user goes to the same page using HTTP, the resultant URI will be evaluated. In this way, site developers can easily create pages that work for either HTTP or HTTPS without starting any mixed content vulnerabilities.


    What is the procedure for installing an external framework or library for Swift in XCode 6? -


    I want to create a new XCode 6 SWIFT project and want to install this framework. The directions given on the Zithub page of the framework seem incomplete, and while searching for full instructions, I've flipped the Goggle and stack over and have tried many things without success, so I am giving support to the inquiry. Thank you in advance. MJB

    There are really awesome installation instructions for frameworks in the Almorer readme section. Please note that you will need to swap AlarmFor specific information for Swifter .

    You may also want to consider using Almond Readme to have some great instructions for using Carthage.


    angularjs - modifying ng-class from directive -


    I am trying to write a command that looks at the width of an element, and determines the ng-class variable conditionally . It is not absolutely certain that I am going right about this and appreciate some help! My html

      & lt; Div ng-class = "{'compact': compact}" calc-width & gt; Stuff here & lt; / Div & gt;  

    My instructions (to date)

      app.directive ('calcwidth', function () {return {restricted: 'a', link: function (Scope, amm, ethers) {var width = elem [0] .clientWidth; scope.compact = false; if (width> 600) {scope.compact = true;}}}}}};  

    First of all, it does not modify the NG-class variable as expected. Second, how do I look for a change in the width of the element? Normally I could just use the window resize function, but the size of the element also changes in other cases such as opening a side panel, am I doing this also? Or would it be better to trigger this instruction from any other instructions / controller / service, which controls the panel? $ watch

    You can see the contents of your link function by $ watch function.

      link: function (scope, amm, ethers) {scope. $ Watch (function () {// This function will be executed for each digest cycle. Var width = elem [0] .clientWidth; scope.compact = false; if (width <600) {scope.compact = true; }}}}  

    PHP Array multiple keys -


    Here's what I want to do:

       

    I need to parse multi-dimensional arrays independently, so I can use it on any multi-dimensional array.

    "post-text" itemprop = "text">

    Still guessing what you are trying to achieve

      $ this- & Gt; MyArray = array ("key1" = & gt; array ("key2" = & gt; array (1,2,3)); Protected function mdparser () {$ result = $ this- & gt; MyArray; For ($ i = 0; $ i & lt; func_num_args (); $ i ++) {$ result = $ result [func_get_arg ($ i)]; } Return result; } $ Result = it- & gt; Mdparser ('key1', 'key2', 1); PHP> = 5.6 allows variadics to be simplified:  
      protected function mdparser (... $ args) {$ result = $ This- & gt; MyArray; Foreign Currency ($ AGR $ ARG) {$ Result = $ Result [$ AG]; } Return result; }  

    json - PandaDOC API PHP issue -


    I am pulling my hair with the Paddock API to send contracts to my customers.

    I have this work and the email and the recipient are going through the information, but I am unable to add it to custom areas. I've tried many ways.

    Below are the requests I need to say:

      {"name": "sample document", "url": "URL_TO_A_DOCUMENT", "recipient": [{"Email": "john.appleseed@yourdomain.com", "first_name": "john", "lastname": "Applied", "role": "u1"},. ...], "Field": {"optId": {"title": "Field 1"}}}  

    Here's my PHP in:

    function - pandadoc ($ access_token, $ array) {$ url = 'https://api.pandadoc.com/public/v1/documents'; $ Docurl = "http://www.mydomain.co.uk/pandadoc/marktest.pdf"; $ Postfilled = array (); $ Postfield ['name'] = 'contract name'; $ Postfile ['url'] = $ docurl; $ Postfields ['Recipient'] = Array (array ('email' = & gt; 'customer@customeremail.com', 'first_name' = & gt; 'John', 'last_name' =>, 'Applied', ' Role '= & gt;' u1 ')); $ Postfields ['fields'] = array ('plFirstname' = & gt; array ('first name' => gt; john));

    If I comment on the field segment - it goes to the correct email and the customer can sign, but I should be able to pass in the RelayTrain custom areas as well.

    P> Maybe you already Solved, but for any person answering, I got to do this work:

      "fields": {"fieldId": {"assignee": "role @ email , "Title": "title for field"}, ...}  

    c++ - Can't figure out why the number of spaces are not counted -



    c++ - Can't figure out why the number of spaces are not counted -

    i have been teaching learning c++ , i've been trying create programme takes string of characters , removes white spaces using pointers. working want ouput number of spaces removed. code looks right on tired eyes. have number of spaces defined spaces. pretty self explanatory i'm trying do. help appreciated! :)

    #include <iostream> using namespace std; int stripwhite(char *str); int main() { char str[100]; cin.getline(str, 99); // save room null character. stripwhite(str); cout << str << endl; cout << "i removed " << stripwhite(str) << " sentence."; homecoming 0; } int stripwhite(char *str) { char *p; int spaces = 0; (p = str; *str != '\0'; ++str) { if (*str != 0x20) { *p++ = *str; } else { spaces++; } } *p = '\0'; homecoming spaces; }

    because you're calling stripwhite on string twice (the first time throwing away number removed) there'll nil remove sec time.

    you need phone call 1 time , save homecoming value, like:

    int count = stripwhite(str); cout << str << endl; cout << "i removed " << count << " sentence.";

    c++ arrays

    How to configure Qt Designer to load PyQt widget in OSX? -



    How to configure Qt Designer to load PyQt widget in OSX? -

    previously work using pyqt extensively in windows: shipped pyqt include pyqt designer that'll load pyqt designer plugin developed using python. allow me drag , drop pyqt widgets in pyqt designer.

    i haven't compile pyqt source, this question, seems source still not including pyqt designer. currently, using qt , pyqt installed using brew.

    so, how configure qt designer (the c++ one) allow load pyqt widgets?

    the question linked explains well. there no such thing "pyqt designer". there qt designer, should installed along qt itself.

    pyqt provides plugin enables custom widgets written in python qt designer. plugin installed default when pyqt installed, unless explicitly configured not using --no-designer-plugin option.

    if start qt designer , open help -> plugins, should see kind of python or pyqt plugin listed there - on mac osx, think plugin should installed in /developer/applications/qt/plugins/designer/).

    osx qt pyqt

    java - How to separate several inputs on a jtextfield -



    java - How to separate several inputs on a jtextfield -

    i doing wage calculator calculate worker's salary according position boss, commission worker , such need take 5 inputs each textfield first name, lastly name, , salary. how seperate each inputs each textfields?

    example : first name: boss, boss, boss, boss, boss lastly name: a, b, c, d, e salary: 1, 2, 3, 4, 5

    output: boss earned 1 boss b earned 2 boss c earned 3 boss d earned 4 boss e earned 5

    here's part of code, can print 1 input

    public void actionperformed(actionevent e) { //boss if (e.getsource() == fldsalary) { string first = fldfirst.gettext(); string lastly = fldlast.gettext(); double salary = double.parsedouble(fldsalary.gettext()); boss boss = new boss(first,last,salary); employee = boss; output = employee.tostring() + " earned php" + precision2.format(employee.earnings()) + "\n \n" ; area.append(output); } }

    use split function

    string last= fldlast.gettext(); // last=" a, b, c, d, e"; string[] parts = last.split(", "); string part1 = parts[0]; // string part2 = parts[1]; // b string part3 = parts[2]; // c string part4 = parts[3]; // d string part5 = parts[4]; // e

    same first , salary (salary should string, parse each 1 double)

    java

    c++ - Using Macros in Resource File -



    c++ - Using Macros in Resource File -

    i trying utilize macros auto-generate build version c++ project.

    if following, works fine.

    versioning.h

    ... #define version_major 1 #define version_minor 0 ...

     

    myapp.rc

    ... #include "versioning.h" vs_version_info versioninfo fileversion version_major, version_minor, 0, 0 productversion version_major, version_minor, 0, 0 fileflagsmask 0x3fl ...

     

    however, if seek , include more complex, such math, compiler generates errors

    #define version_major (2 / 2) error rc1013: mismatched parentheses error rc2104: undefined keyword or key name: /

     

    i need utilize much more complex mathematical expressions, phone call other classes, perform string comparison, etc. within macro.

    my guess there not wrong macros writing, rather problem way resource file handles macros.

    any ideas?

    note: using visual studio ultimate 2013 update 3.

    a resource compiler not flexible source code compiler. cannot utilize complex macros in resource script. if need that, have utilize separate preprocessor perform calculations , generate necessary macro values resource compiler use.

    c++ visual-studio

    linux - get a variable inside and/or outside a tuple using sed or perl -



    linux - get a variable inside and/or outside a tuple using sed or perl -

    input file:

    {custom:{ver:120,name:hello,form:123},name:world,browser:ie} {custom:{ver:130,name:test,form:123},browser:ie}

    sed command:

    sed 's/^.*name:\([^,]*\).*$/\1/' input.txt

    output :

    world test

    how differentiate variable within tuple , outside tuple?

    expected output value of name within custom:

    sed command within custom name

    hello test

    sed command outside custom name:

    world blank or {custom:{ver:130,name:test,form:123},browser:ie}

    note: name can appear anywhere in file--beginning, middle or end--or can absent.

    perl work me. give thanks you.

    name within custom using rather unsophisticated regex:

    perl -lne 'print /custom:\{[^{}]*name:([^,}]*)/ ? $1 : ""' input.txt

    outputs:

    hello test

    name outside custom:

    perl -lne 'print /custom:\{[^{}]*\}(*skip)(*fail)|name:([^,}]*)/ ? $1 : ""' input.txt

    outputs:

    world

    switches:

    -l: enable line ending processing -n: creates while(<>){...} loop each “line” in input file. -e: tells perl execute code on command line.

    linux perl shell sed

    java - @ExceptionHandler not catching exceptions being thrown from Spring Formatters -



    java - @ExceptionHandler not catching exceptions being thrown from Spring Formatters -

    i have controller serves rest web service , 1 of methods expecting model in model have fellow member variable of type myobjectid.

    public class mymodel { private myobjectid objectid; public myobjectid getmyobjectid() { homecoming objectid; } public void setmyobjectid(final myobjectid objectid) { this.objectid = objectid; } }

    i have custom implementation of formatter (org.springframework.format) myobjectid , parse method:

    @override public myobjectid parse(final string text, final locale locale) throws parseexception { // if string invalid throw illegalargumentexception homecoming myobjectidconvertor.convert(text); }

    in spring-servlet.xml registered formatter:

    <bean id="conversionservice" class="org.springframework.format.support.formattingconversionservicefactorybean"> <property name="formatters"> <set> <bean class="com.foo.myobjectidformatter"/> </set> </property> </bean>

    now problem when exception thrown formatter not beingness caught of @exceptionhandler methods. hence response beingness output in format:

    org.springframework.validation.beanpropertybindingresult: 1 errors field error in object 'filtermodel' on field 'myobjectid': rejected value [foo123123]; codes [typemismatch.filtermodel.myobjectid,typemismatch.myobjectid,typemismatch.com.foo.myobjectid,typemismatch]; arguments [org.springframework.context.support.defaultmessagesourceresolvable: codes [filtermodel.myobjectid,myobjectid]; arguments []; default message [myobjectid]]; default message [failed convert property value of type 'java.lang.string' required type 'com.myobjectid' property 'myobjectid'; nested exception org.springframework.core.convert.conversionfailedexception: failed convert type java.lang.string type com.myobjectid value 'foo123123'; nested exception java.lang.numberformatexception: input string: "foo123123"]

    how can create type of exception begin caught @exceptionhandler. 1 of exception handler methods:

    @exceptionhandler(exception.class) @responsebody public responseentity<string> handleexception(final exception ex) { log.error("error handling request", ex); homecoming new responseentity<>(stringutils.hastext(ex.getmessage()) ? ex.getmessage() : "error handling request", httpstatus.bad_request); }

    i had same situation

    i don't handle formatter exception in @controller

    checking following:

    codes [typemismatch.filtermodel.myobjectid,typemismatch.myobjectid,typemismatch.com.foo.myobjectid,typemismatch];

    i suggest work around validationmessages.properties (you need configure localvalidatorfactorybean , reloadableresourcebundlemessagesource)

    for illustration have

    typemismatch.person.datebirth=invalid data, format date of birth incorrect!

    then assuming if wise , friendly user writes invalid date according formatter, dateformatter class, in case throws exception, since have defined code typemismatch.person.datebirth error message show in web form.

    observe our codes similar in way. think spring looks somewhere if of codes exists show appropriate message, since have none code exception stack trace remains, in case how have code , customized message, presented in web form.

    i didn't test yet how customized error message should fit through rest. in case if formatter throws error sure code exists in validationmessages.properties file.

    java spring rest spring-mvc

    python - Django cache, missing keys -



    python - Django cache, missing keys -

    i trying create cache flow, on user request cache big dict of 870 records , should remain in cache time. when defined time pass on next request dict should updated in na cache memory.

    so have created such function:

    from django.core.cache import get_cache def update_values_mapping(): cache_en = get_cache('en') values_dict = get_values_dict() <- create request obtain dict values cache_en.set_many(values_dict, 120) # 120s testing cache_en.set('expire', datetime.datetime.now() + datetime.timedelta(seconds=120))

    then in sec function seek values cache

    from django.core.cache import get_cache def get_value_details(_id): cache = get_cache('en') details = cache.get(_id, {}) # values in cache has expire date should gone expire = cache.get('expire', none) if not details , expire , expire < datetime.now(): update_values_mapping() value = cache.get(_id, {}) homecoming details

    during rendering view get_value_details() called many times obtain needed values.

    the problem of values missing e.g. cache.get('b', {}) homecoming {} if value 'b' saved cache (and expire date not pass yet). missing values changing, 'a', 'b', other time 'c' etc.

    i have been testing on locmemcache , dummycache far. illustration cache settings:

    caches = { 'default': { 'backend': 'django.core.cache.backends.locmem.locmemcache', 'location': 'cache-default' }, 'en': { 'backend': 'django.core.cache.backends.locmem.locmemcache', 'location': 'cache-en' }, 'pl': { 'backend': 'django.core.cache.backends.locmem.locmemcache', 'location': 'cache-pl' } }

    when playing in console of values disappearing cache after next phone call of update_values_mapping(), missing beginning.

    does have clue ? or maybe how solve described flow in way ?

    locmemcache - local memory cache. means it's local particular server process, , won't visible either in other processes or in console.

    if need shared across processes, should utilize proper cache backend memcached or redis.

    python django caching

    java - Error while trying to return a value. -



    java - Error while trying to return a value. -

    i'm stuck on lastly part of homework. have homecoming agent value, reason maintain getting error saying "this method must homecoming type agent", though returning agent. help appreciated.

    import java.io.file; import java.util.hashmap; import jeff.ini.ini; public class configloader { private ini _ini; private hashmap<string, space> _spaces = new hashmap<string, space>(); private hashmap<string, portal> _portals = new hashmap<string, portal>(); private hashmap<string, agent> _agents = new hashmap<string, agent>(); public configloader(file inifile) { _ini = new ini(inifile); } public agent buildall() { _buildspaces(); _buildportals(); _buildexits(); _builddestinations(); _buildagents(); homecoming _selectstartagent(); } private void _buildspaces(){ for(string spacename : _ini.keys("spaces")){ string descrip= _ini.get("spaces", spacename); string image= _ini.get("images", "images"); space space1= new space(spacename, descrip, image, null); _spaces.put(spacename, space1); } } private void _buildportals(){ for(string portalname : _ini.keys("portals")){ string descrip= _ini.get("portal", portalname); portal portal1=new portal(portalname, descrip, null); _portals.put(portalname, portal1); } } private void _buildexits(){ for(string spacename : _ini.keys("exits")){ string spaceexit = _ini.get("exits", spacename); space space = _spaces.get(spacename); portal exit = _portals.get(spaceexit); space.setportal(exit); } } private void _builddestinations(){ for(string portalname : _ini.keys("destinations")){ string destination = _ini.get("destinations", portalname); space des = _spaces.get(destination); if(des == null){ system.out.print("error"); system.exit(1); } else{ portal portal = _portals.get(portalname); portal.setdestination(des); } } } private void _buildagents(){ for(string agentname : _ini.keys("agents")){ string agent = _ini.get("agents" , agentname); space space = _spaces.get(agent); if(space == null){ system.out.print("error"); system.exit(1); } else{ agent = new agent(space, agentname); _agents.put(agentname, a); } } } private agent _selectstartagent(){ for(string agentname : _ini.keys("start")){ string agent = _ini.get("start" , agentname); agent agent1 = _agents.get(agent); if(agent == null){ system.out.print("error"); system.exit(1); } else{ homecoming agent1; } } } }

    the key execution paths must homecoming value of type agent, null. calling method must, usual, check whether returned value null.

    now let's @ missing:

    the if branch not homecoming value, instead abruptly exits. if for loop never entered, method not homecoming either.

    with fixed, entire code like:

    for (string agentname : _ini.keys("start")){ string agent = _ini.get("start" , agentname); agent agent1 = _agents.get(agent); if (agent == null){ system.out.print("error"); homecoming null; } else { homecoming agent1; } homecoming null; }

    java

    plot - How do I assign a legend to some data within a for loop in Python? -



    plot - How do I assign a legend to some data within a for loop in Python? -

    i have python code plots figure. figure contains 5 curves. each curve made of 5 points. want label these curves using legend.

    lets 5 curves have next marker, colour , label designations:

    markers = ['o','s','p','h','d'] colours = ['b','g','r','y','k'] labels = ['a','b','c','d','e']

    just clarity first curve made of 5 "o" points, points bluish , labelled "a".

    my info list of lists so:

    curve1 = [1,2,3,4,5] curve2 = [2,3,4,5,6] curve3 = [3,4,5,6,7] curve4 = [4,5,6,7,8] curve5 = [5,6,7,8,9] xaxis = [1,2,3,4,5] info = [curve1,curve2,curve3,curve4,curve5]

    now plot 5 curves so:

    for j in range(len(xaxis)): in range(len(xaxis)): pylab.plot(xaxis,data[i],color=colours[i],marker=markers[i],label=labels[i]) pylab.legend(loc=0) pylab.show()

    note there loop within loop causes legend print out each label 5 times. how can around ?

    you need add together custom label each:

    for i,curve in enumerate(data): pylab.plot(xaxis,curve,color=colours[i],marker=markers[i],label=labels[i]) pylab.legend(loc=0) pylab.show()

    this should give:

    python plot legend

    Create windows executable using python setuptools -



    Create windows executable using python setuptools -

    python setup.py bdist_windist

    error:

    warning: can't read registry find necessary compiler setting create sure python modules _winreg, win32api or win32con installed. error: [errno 2] no such file or directory: '/usr/lib/python2.7/distutils/command/wininst-6.0.exe', /usr/lib/python2.7/distutils/command/wininst-6.0.exe not included in debian packages.

    solution page:

    we cannot include .exe files, because these not built source. hint: re-create these source package.

    but can found exes copy.

    you can not create windows .exe on debian/linux. need have windows machine python installation or vm.

    python setuptools ubuntu-14.04

    python - Generate a gradient from extrema of a float Image -



    python - Generate a gradient from extrema of a float Image -

    as title states, need generate gradient lowest value highest value of given float image. shall serve legend image.

    my thought create image , fill every pixel of value within range of extrema. still not pro in python, help nice. got far:

    im = image.open('path_to.tiff') extrw=im.getextrema() grad = image.new('f', (10, 100)) pix = grad.load() in range(grad.size[0]): # every pixel: j in range(grad.size[1]): pixels[i,j] = (some_float)

    as can see need somehow utilize extrema float values accordingly pixels create gradient. nice, if remain in pil library.

    thank you!

    after research found linear function. had to set minimum, maximum , length mathematical form : y=m*x+b

    with help of kollegue figured: y(the pixel value)= ((minvalue-maxvalue)/h(heigth of image))*index_of_pixel+maxvalue. in code form:

    extw=im.getextrema() grad_b = 10 grad = image.new('f', (grad_b, im_h)) pix = grad.load() in range(grad.size[0]): # every pixel: j in range(grad.size[1]): pix[i,j] = (extw[0]-extw[1]/im_h)*j+extw[1]

    python python-imaging-library

    utf 8 - Read next character (full unicode code point) from Java input stream -



    utf 8 - Read next character (full unicode code point) from Java input stream -

    i need parse utf-8 input (from text file) character character (and character mean total utf-8 character (utf-8 code point), not java's char).

    what approach should use?

    since java 8 there's charsequence.codepoints()

    for example:

    // if want work line line, utilize files.readalllines() // if utilize guava, there's guava's files.tostring() reading whole file string byte[] bytes = files.readallbytes(paths.get("test.txt")); string text = new string(bytes, standardcharsets.utf_8); intstream codepoints = text.codepoints(); // code points codepoints.foreach(codepoint -> system.out.println(codepoint));

    java utf-8

    apache - RewriteRule redirect all to index.php when folder exist -



    apache - RewriteRule redirect all to index.php when folder exist -

    in server have

    .htaccess

    errordocument 403 index.php rewriteengine on rewriterule ^(.*)$ index.php?rec=$1 [l,qsa] index.php

    folder1

    .htaccess='deny all'

    folder2

    .htaccess='deny all'

    folder3

    .htaccess=''

    folder4

    .htaccess=''

    i want redirect index.php, work all, when seek on existing folders no .htaccess, without slash, this:

    domain.com/folder3domain.com/folder4

    it redirect to

    domain.com/folder3 -------> domain.com/folder3/?rec=folder3 domain.com/folder4 -------> domain.com/folder4/?rec=folder4

    but whant this

    domain.com/folder1 -------> domain.com/folder1/ .......ok domain.com/folder2 -------> domain.com/folder2/ .......ok domain.com/folder3 -------> domain.com/folder3/ .......not work, domain.com/folder3/?rec=folder3 domain.com/folder4 -------> domain.com/folder4/ .......not work, domain.com/folder4/?rec=folder4 domain.com/folder1/ -------> domain.com/folder1/ .......ok domain.com/folder2/ -------> domain.com/folder2/ .......ok domain.com/folder3/ -------> domain.com/folder3/ .......ok domain.com/folder4/ -------> domain.com/folder4/ .......ok

    the question this: why if folder haven't "deny all" redirect differ when link him without slash, , how solve problem, redirected index.php on root folder.

    apache .htaccess mod-rewrite url-rewriting url-redirection

    objective c - iOS app with iphone target only (non-universal) renders fine on ipad iOS7 but not on ipad iOS8 -



    objective c - iOS app with iphone target only (non-universal) renders fine on ipad iOS7 but not on ipad iOS8 -

    when run targeted iphone app on ipad ios7, renders in iphone mode , want. in fact, when print size of window bounds, correctly prints out 320 x 480. however, when run same app on ipad ios8, app goes total screen mode window bounds 1024 x 768.

    do know how can restrict ios8 ipad render app iphone app , not total screen ipad app?

    note: did testing on same ipad device before , after upgrade ios7 ios8. i'm consistently able repro ipad simulators

    this might caused known bug in xcode-6 fixed in xcode-6.1 beta. if using storyboard launch file, ios 8 ipad not scaled iphone mode, treated actual ipad. prepare bug, utilize static launch images hitting use asset catalog on next screen in target options, general tab:

    after this, create sure have static launch images uploaded .xcassets, or update xcode 6.1 beta prepare issue.

    objective-c cocos2d-iphone ios8

    SASS inspect() for array or another method how to output an array -



    SASS inspect() for array or another method how to output an array -

    my question how create sass function inspect() work arrays or how output array way.

    my basic illustration code:

    @function z($layers...) { @warn "`#{inspect($layers...)}`"; } .test { z-index: z("test", "test2"); }

    which generates error wrong number of arguments (2 1) 'inspect'

    how can output $layers variable within @function z? thanks

    http://sassmeister.com/gist/a8b0610d63d23164328a

    the inspect() function takes single argument. using ... notation, you're expanding list individual arguments function. that's why it's complaining you've supplied 2 arguments when 1 expected.

    @function z($layers...) { @warn "`#{inspect($layers)}`"; }

    sass

    Setting timeout for Jodd HTTP client? -



    Setting timeout for Jodd HTTP client? -

    i using jodd http client testing rest apis. works fine (great, actually:) except not sure how set socket time out value. sometimes, when server not up, need wait long time (because of default systems timeout big).

    i using http request this:

    httpresponse response = httprequest.get("http://server").query("p1", "v1")....send();

    i not see timeout related method in httprequest class.

    you have 2 options here.

    the first way described in docs :) anyway, thought tweak httpconnection this:

    httprequest request = httprequest.get()...; request.open(); sockethttpconnection httpconnection = (sockethttpconnection) request.httpconnection(); socket socket = httpconnection.getsocket(); socket.setsotimeout(1000); ... httpresponse response = request.send();

    however, since required, added in latest version (not yet released) timeout method, in future able set with:

    httprequest.timeout(1000);

    hope helps.

    jodd

    crash - android volley crashes without internet connection -



    crash - android volley crashes without internet connection -

    i ve got problem. took me while figure out volley or better, finish app crashes when tries send info no connection (2g/3g/lte,wifi). can happen if smartphone in flight mode or got no net connection.

    here source code:

    public class appcontroller extends application { public static final string tag = appcontroller.class .getsimplename(); private requestqueue mrequestqueue; private imageloader mimageloader; private static appcontroller minstance; @override public void oncreate() { super.oncreate(); minstance = this; } public static synchronized appcontroller getinstance() { homecoming minstance; } public requestqueue getrequestqueue() { if (mrequestqueue == null) { mrequestqueue = volley.newrequestqueue(getapplicationcontext()); } homecoming mrequestqueue; } public imageloader getimageloader() { getrequestqueue(); if (mimageloader == null) { mimageloader = new imageloader(this.mrequestqueue, new lrubitmapcache()); } homecoming this.mimageloader; } public <t> void addtorequestqueue(request<t> req, string tag) { // set default tag if tag empty req.settag(textutils.isempty(tag) ? tag : tag); getrequestqueue().add(req); } public <t> void addtorequestqueue(request<t> req) { req.settag(tag); getrequestqueue().add(req); } public void cancelpendingrequests(object tag) { if (mrequestqueue != null) { mrequestqueue.cancelall(tag); } } public void addtorequestqueue(jsonobjectrequest jsonobjreq, string tag_json_obj) { // todo auto-generated method stub getrequestqueue().add(jsonobjreq); }

    }

    this how requests looks within app. going send jsonobject.

    public static void sendsms(jsonobject obj) { // tag used cancel request string tag_json_obj = "json_obj_req"; string url = "http:/<ip>/<file>.php"; jsonobjectrequest objreq = new jsonobjectrequest(method.post, url, obj, new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { log.d(tag, response.tostring()); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { volleylog.d(tag, "error: " + error.getmessage()); // hide progress dialog } }); // adding request request queue appcontroller.getinstance().addtorequestqueue(objreq, tag_json_obj); }

    if smartphone gots net connection (2g/3g/lte,wifi), working fine. if in flight mode error:

    can please help me handle this? tryed "try" , "catch" blocks isn´t working me. can volley manage without crashing app? in advance! :)

    i think throwing npe becuase of line:

    volleylog.d(tag, "error: " + error.getmessage());

    the "error" object might null.

    android crash try-catch send android-volley

    create a function with variable pointers parameters in C -



    create a function with variable pointers parameters in C -

    how create function variable pointers parameters take number of pointer , print such :

    print("hello ","world "); print("i'm ","adil"," blah "," blah");

    result :

    $ ./myprogramme hello word im adil blah blah

    i found stdarg.h don't know how create ?

    in c, can create variadic function using stdarg.h. illustration wikipedia link,

    #include <stdarg.h> double average(int count, ...) { va_list ap; int j; double sum = 0; va_start(ap, count); /* requires lastly fixed parameter (to address) */ (j = 0; j < count; j++) { sum += va_arg(ap, double); /* increments ap next argument. */ } va_end(ap); homecoming sum / count; }

    c

    java - Error parsing HTTP request header -



    java - Error parsing HTTP request header -

    i trying send post request browser server(local host). request url :

    http://localhost:8080/mypath/myservlet?requestdata={ .......//json string......};

    requestdata json string (i using gson purpose.) working fine until info in json string exceeds particular limit. say, sending array of objects in json string. if number of objects in list exceed 67 next error :

    org.apache.coyote.http11.abstracthttp11processor process info: error parsing http request header note: farther occurrences of http header parsing errors logged @ debug level.

    why so? totally confused. why happen , needs done prepare this? want understand reason behind this, don't understand after particular number of objects stops working , error in console.

    thanks.

    it seems using post incorrectly. although using post sending json request parameter style. when using post should send content request body. in case no reasonable size limitation exist.

    java http servlets

    Native packed JavaFX app not working on windows -



    Native packed JavaFX app not working on windows -

    when creating native javafx using gradle plugin (http://goo.gl/yio0xk) works great on macos. on windows exe file. when starting file there message mscvp100.dll missing. installed .net 4 runtime , microsoft visual c++ 2010 redistribution bundle (see link http://goo.gl/nomxyo). if start exe 2 error dialogs:

    configuration file not found! c:\users\hendrik\desktop\app\package.cfg

    and

    failed find main application jar! failed parse bundle configuration file

    i think sec 1 depends on first one. thought how can solve problem?

    working :)

    this fault , lack of knowledge of windows... when building native bundle on windows folder exe, icon file , 2 folder (app, runtime). can't re-create exe. run app need content. need re-create / move finish folder , not exe.

    windows javafx javafx-8

    sql - TSQL - Partial Matching using LIKE for multiple values -



    sql - TSQL - Partial Matching using LIKE for multiple values -

    i seek advice whether function in sql server allow me perform partial matching list of values ?

    the entire string need matched passed in via store procedure.

    i trying find other alternative before writing own function split string comma , union results before homecoming info program.

    for example, pass in next string tsql

    apple,orange,pear

    in where clause should match

    select * store fruits 'apple%' select * store fruits 'orange%' select * store fruits 'pear%'

    can accomplish above results in single sql statement rather writing function break each string ?

    data in table

    apple reddish apple greenish orange sweetness orange sour pear big pear little

    so, when passed in string "apple,pear" , need homecoming

    apple reddish apple greenish pear big pear little

    try this, performance not great

    declare @parm varchar(200) set @parm = ','+'apple,orange,pear'+',' select * store charindex(fruit,@parm) > 0

    sql sql-server tsql

    Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission -



    Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission -

    i set permission why still error: caused by: java.lang.securityexception: "gps" location provider requires access_fine_location permission.

    my manifest.xml file:

    <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> public class locationactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_location); if (savedinstancestate == null) { getfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()) .commit(); } } /** * placeholder fragment containing simple view. */ public static class placeholderfragment extends fragment { private locationmanager mlocationmanager; public placeholderfragment() { } private final locationlistener locationlistener = new locationlistener() { @override public void onlocationchanged(location location) { txtlat = (textview) findviewbyid(r.id.textview1); txtlat.settext("latitude:" + location.getlatitude() + ", longitude:" + location.getlongitude()); } @override public void onstatuschanged(string provider, int status, bundle extras) { } @override public void onproviderenabled(string provider) { } @override public void onproviderdisabled(string provider) { } }; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_location, container, false); mlocationmanager = (locationmanager) getactivity().getsystemservice(location_service); mlocationmanager.requestlocationupdates(locationmanager.gps_provider, 0,0, locationlistener); homecoming rootview; } } }

    what targetsdkversion?

    on apps target android 6.0 (api level 23) or higher, create sure check , request permissions @ runtime. determine if app has been granted permission, phone call new checkselfpermission() method. request permission, phone call new requestpermissions() method. if app not targeting android 6.0 (api level 23), should test app under new permissions model. : from android site

    in android 6.0 marshmallow, application not granted permission @ installation time. instead, application has inquire user permission one-by-one @ runtime only if application target level 23.

    for older version: if application's targetsdkversion set less 23. assumed application not tested new permission scheme yet , switch same old behavior: user has take every single permission @ install time , granted 1 time installed !

    location

    coding style - Are there practical or technical advantages to using 2-space vs 4-space indents? -



    coding style - Are there practical or technical advantages to using 2-space vs 4-space indents? -

    aside taste, habit , personal preference, there advantages using 2-space vs. 4-space indents while coding?

    for instance, in google style guide, recommended utilize 2-space indents css.

    are there technical advantages using 1 on other, instance when transferring info between different systems?

    are there accepted conventions? (that perchance differ language language)

    there no clear "technical" advantages 1 way or other. indeed "technical" issue can think of impact on number of bytes in source file.

    if represent indents using space characters (ascii sp), 2 spaces 2 characters fewer 4 spaces.

    if allow tab characters used, (on windows) tab indents 4 spaces, tab characters result in fewer characters. flip side tab conventionally indents 8 spaces on many other operating systems, if want source code nice on platforms shouldn't utilize tab indentation.

    and besides, mutual practice "minify" css, javascript , web-associated languages create websites "faster". among other things, strip out indentation, rendering minor technical difference moot.

    (for human readable version of css, saving in transmission time / storage space trivial worry about. today's systems optimized mass market, storing , moving around gigabyte-sized files (movies) common-place. source code pales insignificance.)

    as "practical" advantages, guess may easier view , edit files if don't waste much screen real-estate deep indentation. perspective 2 character indentation improve 4 or 8 character indentation.

    however, borders on beingness "personal taste" issue. (except when using justification asking boss yet ultra-wide monitor on desk :-) )

    are there accepted conventions?

    in general no.

    in languages, maybe, can't think of any. in java, mutual convention indentation 4 spaces, others acceptable.

    coding-style compatibility

    ruby - Search and match string, only after a certain point in a file -



    ruby - Search and match string, only after a certain point in a file -

    how do scan file after finding particular line. first results not count. illustration (search 3s after finding line says "begin here"):

    sample file 1 3 3 4 begin here 2 3 3 1 4

    the expected output 2 3s

    ruby's .. operator friend:

    data.each_line |line| line.chomp! next unless (line =~ /^begin here$/) .. false puts line if line == '3' end __end__ 1 3 3 4 begin here 2 3 3 1 4

    save file , run , you'll see:

    3 3

    .. (and much more obscure ...) come perl, , useful particular kind of use.

    what happens .. two-state operator works if or unless first status line =~ /^begin here$/ in case. when status met, operator sticks, i.e., returns true until sec test matches, (returns true). 1 time happens, flip-flop starts returning false again.

    in code, i'm fooling returning true, because sec test false. in other words, code reads end of data.

    .. (and ...) really useful when you're scanning file, looking blocks of info occur throughout file. if sec conditional test found end of block, .. reset , code skip through file until found next block start, triggered, , started capturing again.

    it's people haven't seen __end__ or data used. __end__ way tell ruby there no additional code executed beyond point. data internal file handle points lines next __end__ , can treated io , file objects. it's useful supplying info must have script, don't want set separate file. in case i'm pretending lines after __end__ separate file. easy-peasy.

    ruby

    Can default visibility in Java Class have a protected member? -



    Can default visibility in Java Class have a protected member? -

    in java, point of view, not create sense default-visible class have protected member. point view, not create sense because default visibility in java = package-level protected visibility in java = package-level + subclass( regardless of package)

    class testclass{ protected int addintegers(int a, int b){ homecoming (a+b); } // end of protected addintegers(int a, int b){ }

    am right above code nonsense?

    you have public class foo in same package, extending base of operations class, , class bar in package, extending foo , overriding protected method.

    package a; class base of operations { protected void bang() { } } bundle a; public class foo extends base of operations { } bundle b; public class bar extends foo { @override protected void bang() { } }

    java default semantics protected

    internet explorer 8 - javaScript Dynamic date not working in IE8 -



    internet explorer 8 - javaScript Dynamic date not working in IE8 -

    i using below script generate dynamic date.

    below code.

    the html:

    <span id="spandate"></span>

    the script:

    var months = ['01','02','03','04','05','06','07', '08','09','10','11','12']; var tomorrow = new date(date.now()); document.getelementbyid("spandate").innerhtml = ('00' + tomorrow.getdate()).slice(-2) + "/" + months[tomorrow.getmonth()] + "/" + tomorrow.getfullyear();

    fiddle demo link

    it working fine on browsers, date not displaying on standalone ie8. works while alter browser mode ie9/10 ie8, somehow not working in actual ie8.

    date.now() doesn't work on ie-8! think thats problem.

    javascript internet-explorer-8

    javascript - Stretch submenu to parent menu size -



    javascript - Stretch submenu to parent menu size -

    i creating horizontal dropdown menu css , javascript. have made menu stretch width want (956 px) , menu options spread out in this, don't know how submenus want them. want each 1 of them have same width parent. can help me this?

    html:

    <div id="nav"> <div id="meny"> <ul id="menu"> <li class="dropmenu"><a href="#">abcde</a> <ul class="submenu"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> </ul> </li> <li class="dropmenu"><a href="#">fghijklmn</a> <ul class="submenu"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> </ul> </li> <li class="dropmenu"><a href="#">shop</a> <ul class="submenu"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> </ul> </li> </ul> </div> </div>

    css:

    #nav{ width: 956px; margin-left: auto; margin-right: auto; } #meny{ display: table; width: 100%; border-collapse: collapse; border: none; } #menu{ display: table-row; list-style: none; } .dropmenu{ display: table-cell; background-color: #ff5b2e; } .dropmenu a{ display: block; text-decoration: none; text-align: center; } .submenu{ display: none; list-style: none; background: #ff5b2e; padding: 0; position: absolute; } .submenu li{ width: 100%; }

    javascript:

    $(document).ready(function() { $('.dropmenu').hover(function() { $(this).find('.submenu').slidetoggle(); }); });

    ok, sense should solvable without javascript. here's did:

    (1) remove position:absolute .submenu (is there reason why wanted there?)

    .submenu{ display: none; list-style: none; background: #cc0000; padding: 0; width: auto; }

    (2) move background-color .dropmenu .dropmenu a

    .dropmenu { display: block; text-decoration: none; text-align: center; background-color: #ff5b2e; }

    (3) additionally, noticed when hover on submenu several times, dropdown toggle several times too. note stop() added on line on js:

    $(this).find('.submenu').stop().slidetoggle();

    fiddle: http://jsfiddle.net/ouz0q5lj/1/

    javascript jquery html css drop-down-menu