Posts

Showing posts from July, 2011

How to display a Rails flash notice upon redirect? -

मेरे पास एक रेल नियंत्रक में निम्नलिखित कोड है: flash.now [: नोटिस ] = चेक_इन_पैथ फिर / चेक_इन दृश्य में: '' सफलतापूर्वक चेक इन '' में चेक किया गया है: & lt; p id = "notice" & gt; & lt;% = नोटिस% & gt; & lt; / p & gt; हालांकि, नोटिस दिखाई नहीं देता। यदि नियंत्रक में रीडायरेक्ट नहीं किया जाता है तो मैं सही काम करता हूं: फ्लैश। अब [: नोटिस] = 'सफलतापूर्वक चेक इन' रेंडर एक्शन: 'चेक_इन' मुझे हालांकि एक रीडायरेक्ट की आवश्यकता है ... न केवल उस क्रिया का प्रतिपादन क्या पुनर्निर्देशन के बाद मेरे पास फ्लैश नोटिस हो सकता है? ".now" निकालें तो बस लिखो: फ्लैश [: नोटिस] = 'चेक_इन_पथ के लिए रीडिंग_ में' सफलतापूर्वक चेक किया गया '। विशेष रूप से जब आप उपयोग करते हैं बस प्रतिपादन और पुनर्निर्देशन नहीं। रीडायरेक्ट करते समय, अब उपयोग नहीं किया जा सकता है।

Rails model as_json overwriting default values -

I am trying to overwrite default model values ​​for JSON, but instead of overwriting it is a duplicate hash My model: class home screen button & lt; ActiveRecord :: Base is_to: product_category Valid: product_category_id ,: x ,: y ,: presence = & gt; Correct attr_accessible: product_category_id, x, y def as_json (option = {}) hash = super (option) hash. Merge ({: product_category_id => "fdfd"}) end My Controller: DIF Index @home_screen_buttons = HomeScreenButton.all response_to do | Format | Format.html # index.html.erb format.json {json: @home_screen_buttons} End End When I open Jason, I show a duplicate for product_category_id: [[ "Created_at": "2013-03-17T11: 14: 32Z", "id": 1, "product_category_id": 5, "updated_at": "2013-03-17T11: 14: 32Z", "X": 300, "Y": 200, "product_category_id": "dfdffff"}] there Hash = [fdfd] hash and

parsing sql statement in haskell -

I am newbie to hackle How to parse the SQL statement "a to b Select where I am referring to the Parsing SQL Statement (value 1, value2, value3, ...), using "hackel You will need the import text to parse this package. Select one from the filename "" for the reader , then case pars p_sql "error message where one (value1, value2, value3, ...)," Left error - & gt; - Handle the correct statement - & gt; - Do something with your predicted SQL statement

javascript - How to write this in a more sophisticated way? -

This works, but I'm sure it's written more clearly. & lt; Script & gt; $ (Document) .ready (function () {$ ('. Col'). CSS ({'height': ($ (document) .height ()) + 'px'}); $ (window) .resize ( Function () {$ ('colonel'). Css ({'height': ($ (document). ()) + 'Px'});})}} gt; I have tried without the first $ ('.cale)' CSS ... and it does not work. So basically what I say to the browser "When the document is ready, resize this div, and resize it at every height change." this Here is: & lt; script & gt; $ (window). Resize (function () {$ ('. Col'). CSS ({'height': ($ (document) ). You can listen to the resize event and when the document is ready (); & lt; / script & gt; If it is done, then it can trigger. Other small changes: You can enter document.ready with $ (function () {}) Resizing event listener can be made before document.ready , becaus...

haskell if exception -

मेरे पास ऐसा कुछ है isLastPermutation (h: t) = पकड़ (nextPermutation H: t)) (\ e- & gt; वापस सही) वापस लौटें कुछ मामलों में अगलाप्रतिष्ठापन एक अपवाद फेंकता है और मैं अपना कार्य चाहते हैं isLastPermutation सही करने के लिए अगर अगलाप्रतिष्ठापन अपवाद अन्यथा गलत है। अन्यथा शुद्ध हास्केल में प्रवाह-नियंत्रण के लिए अपवाद का उपयोग न करें। शायद या या तो का उपयोग करें।

ios - Dealloc an NSObject using ARC -

I have many visual controllers that are with a strong reference to the subclass of NSObject. Each view controller will allow the user to make this object Allows to change in some fashion and then passes the object to the next visual controller. Once the user was able to complete these changes and the process started with a new instance of NSBZ subclass. The problem I am facing is that some view controllers on the stack retain the context of committed examples. I have tried to use weak, and unsafe, but it makes it difficult to pass the object between the view controllers. I basically need an example dealloc of an object once committed, so that the references to any view controllers will be zero. However, ARC does not allow clear calls to dealloc. Can I solve it using NSNotificationCenter or by using a representative, but is there a cleaner way to do this? Any insights will be greatly appreciated thanks! "post-text" itemprop = "text"> Model object (...

xml - Open quote is expected for attribute "android:id" associated with an element type "EditText" -

This is the first time I try to write for the app and I have seen this problem which is more people, but I can not find the answer. It is considered "wrong type", but there is no one in it. Also, all the text boxes are written evenly, but only the first thing has happened. I tried to switch them but only before Only it was received. & lt; XML version = "1.0" encoding = "utf-8"> EditText android: id = @ + id / editText2 Android: layout_width = "Wrap_content" android: layout_height = "wrap_content" android: EMS = "10" Android: inputType = "numberSigned" Android: width = "1DP" & gt; & Lt; RequestFocus / & gt; & Lt; / Edittext & gt; & Lt; Edit text Android: id = @ + id / edittext3android: layout_width = "wra p_content" android: layout_height = "wrap_content" android: EMS = "10" Android: inputType = "numberSigned" Android: width = ...

creating a new branch in git with one commit omitted -

There are 2 branches in my branch 2 and branch 2. Branches. Output of GIT logs at branch 1: commit 'A' commit 'b' commit 'c' commit 'd' P> GIT log out on branch2: commit 'f' commit 'a' commit 'c' committi 'd' and I have a new It is like building a branch which is in sync with branch 1 and also has changes that are only in 'F'. So the new branch should look like this > class = "post-text" itemprop = "text"> git checkout- b [new branch name] git cherry-pick [command 'f'] [

java - Spring batch doesn't execute flow in parallel mode. -

The spring batch does not execute the flow in parallel mode. What am i doing & lt; Split id = "preprocessingStep" next = "decompress" & gt; & Lt; Flow & gt; & Lt; Step ID = "Step 11" Next = "Step 22" & gt; & Lt; Task ref = "my 1" /> & Lt; / Step & gt; & Lt; Step id = "step 22" & gt; & Lt; Tasklet Ref = "My2" /> & Lt; / Step & gt; & Lt; / Flow & gt; & Lt; Flow & gt; & Lt; Step id = "step 33" & gt; & Lt; Task ref = "my 3" /> & Lt; / Step & gt; & Lt; / Flow & gt; & Lt; / Split & gt; I think this is because you use a one-thread work executor Are there. & lt; Bean id = "taskExecutor" class = "org.springframework.core.task.SimpleAsyncTaskExecutor" and In your config

Abbreviation for ternary operator in python -

I remember a hatred for the Tannery operator test for survival. For example: a = none b = another and none if 'no!' #b is 'no one else!' I thought it was something like this and 'none'! But this does not work, maybe there is another way of short form to use some other underlying type in it? No, no one is available briefly. Do you have about a or 'no, none!' Thinking about ? And as a side note: ... if ... and ... is called a; This is the A TURNERY operator, but this is the case of SQL ... in ... expression.

oop - optional arguments in initializer of python class -

I was thinking that someone quickly explains how to define user-defined objects efficiently and in a dragon manner with alternative arguments Prepare For example, I want to create this object: square object: def __init __ (self, some_other_object, i, * j, * k): self.some_other_object = some_other_object self.i = I # If J is specified, then assume that it is = i if (j == none): self.j = i else: self.j = j # if k is given, value 0 if (k = = None): self.k = 0 and: self.k = k Is there a better way of doing this? Edit: I have changed the code so that it is understood more comprehensive and more easily. You can define the default parameters: class optical transition (Object): def __init __ (self, chemical, i, j = none, k = 0) self.chemical = chemical self.i = i self.k = k self.j = j if j is not, no more No I If you do not explicitly call the class with j and k , they will use those default When you create an object, then you use all four parameters as usual. You...

c# - How To Test If Hotmail Account Exists? -

I am trying to check if my Hotmail account exists or not, but the following code did not help me . Public Bull ISAxist's_MTPP method (string email) {string domain = email.Substring (email.InexexOf ("@") + 1); Var server = _commander.getmxservers (domain); Socket socket = faucet; Forex Currency (MXSverver MX Server in Server) {IPHostentiary IPHost = DNS Resolve (MXSverver MailExchange); IPDPpoint and point = new IPPpoint (IPHOST address list [0], 25); Socket = new socket (endpoint, addressfamily, socket type stream, protocol type. TCP); Socket.Connect (last point); If (! Czech response (socket, resp .num connectivity)) {socket.Close (); } Else {// If connected, send SMTP command {SendData (socket, string.format ("halo {0} \ r \ n", "machinename"); If (! Czech Response (Socket, ResponseNen. GenerisSutus)) {Socket. Stop it (); to continue; } SendData (socket, string.format ("from mail: \ r \ n", "from@domain.com")); Check Respo...

python - Django How to find out if earlier than 7pm in a specific timezone -

I am new to Django / programming and am trying to write some code that will tell me whether it should be from 7 o'clock First is a specific time zone (I provide timezone). If this type of question has been said a lot then I am sorry. I searched an answer but did not come up with the solution I appreciate time and expertise. I found a solution that works: tz = Timezone ('US / Eastern') datetime.now (Timezone (tz)). Hour & lt; 19

javascript - Internet Explorer 8 get value of Radiobutton -

I'm googling for about 2 hours to fix the following problem (other Stackoverflow questions are included): & Lt; Input type = "radio" name = "lightType" value = "tube" / & gt; As you can see, I'm just trying to retrieve the current value of the radio button group "LightType" to work with it. This is Firefox / Safari / Chrome I'm working like a magic in, but IE8 is giving me a hard time by returning an empty string. I have already tried several hacks from other questions like compelling the incident of change in radio buttons and blurting the radio buttons clicked on IE8 and setting it on fire. Maybe I'm suffering from blindness right now. I am working with the latest jQuery version and I've ensured that no other tied events interfere. Interestingly, however, adding a warning () before receiving the value and IE returns the current value: . // DO job alerts (); Warning (jQuery (this) .val ()); // Warning...

fonts - Alternative of FontMetrics in Java -

My code uses getFontMetrics () which dislikes. What can be optional? Public Zero Set Font (font font) {if (font == null) {font defaultFont = (font) javax.swing.UIManager.getDefaults (). "Label.fonts"); Font = new font (defaultFont.getName (), font .BOLD, defaultFont.getSize () + 8) ;; } Font Metrics Font Metrics = Toolkit.Get Default Toolkit (). GetFontMetrics (font); FontHeight = fontMetrics.getHeight (); FontDescent = fontMetrics.getDescent (); FontLeading = fontMetrics.getLeading (); If (text! = Null) fontWidth = Toolkit.getDefaultToolkit () GetFontMetrics (font). Stringing (text); CurrentFont = font; Superset font (font); } Any suggestions? Javadoc tells you According to JDK version 1.2, the font method Has been replaced by getLineMetrics.

Composer on Windows 7 (x64) PHP 5.4.7 -

I'm not new to composer and I'm already using it on Linux and Windows for a long time, but today I had to face a problem. Today I tried to use the Composer Update / Composer install on my Windows 7 and then found an exception: " The composer could not find the config file: "This is strange, because it was working a few days ago. I tried to use the latest composer .phar and also composer-setup. Tried to use a musician established by Exe, I also tried composer.It is always thrown out of the same exception by placing it on a different location (project location etc.). When I run a valid mandator, I have received: ./ composer.json is valid , so composer.json has been found and valid. Thanks for all the replies from the environment variable and convertible (restart) windows Remove composer paths and variables then add variables and paths again

java - How to reset default launcher/home screen replacement? -

When the user clicks on the home then he is given the option of the launcher and he can also decide whether to default The problem is whether or not it is difficult to change it again later. To fix this, I have a "Reset Preferred Launcher" that turns it on: getPackageManager (). ClearPackagePreferredActivities getPackageName ()); However, this line only resets the preferred launcher if it has chosen my launcher. I need a snippet that cleanses the favorite launcher, so the next time the user clicks on the home, the option is redistributed. This is not directly possible, and Android developers have said that they will not allow an app to alter the user's preferences However, there is an alternative solution based on how these options maintain Android. Look like your manifest: & lt; Activity Android: name = "MyLauncherActivity" Android: exported = "true" /> & Lt; Activity- alias android: name = "LauncherAlias1" And...

jpa - Why entityManager.contains returns different results? -

This is in JPA2 (Eclipse Link) and JSF2. I have a student of the unit class: @Entity public class student serializable {Private stationary last long serialvarsian UID = 1L; @ Id @ Generated Values ​​(strategy = generation type.eeto) Private long id; Private string firstname; Private string last name; Personal gaps ages; Public student (string firstname, string lastname, int era) {this.firstname = firstname; This .lastname = lastname; This.age = age; } Public Student () {} // Accessors and Mutes Here} Session Bean Student Fact which handles Effectfacade: Public Essentials Comprehensive & lt ; T & gt; {Private Sector & lt; T & gt; EntityClass; Public Abstracts (class unit class) {this.entityClass = entityClass; } Secure Essential EntityManager getEntityManager (); Public Zero Generation (T organization) {getEntityManager (). Continues (unit); } Public T Edit (T unit) {return getEntityManager (). Merge (unit); } Public Zero Extraction (T Institution) {getEn...

python - "Load more" pagination button in multiple tables. Django -

I have a form that queries a database and returns the information given in multiple tables. The row number of each column can reach hundreds. Each line is given as a custom model, which I have declared that all the rows for a given table are stored in the object container. I initially only want to load the first 50 rows in each table. At the bottom of each table, I want to have a "load more" button which loads more than 50 questions on the click (or the result is less than 50) Django's pagination tutorial It seems that I can only split the pages on different pages. Can I line align with a load more button? Or is it impossible for me to do? Edit: Here I am currently printing rows for each table, it is a simple to loop { Row%} in% R & lt; Tr & gt; & Lt; Td> {{R.name}} & lt; / Td> & Lt; Td> {{R.age}} & lt; / Td> & Lt; Td> {{R.state}} & lt; / Td> & Lt; / TR & gt; {% endfor%} This is my view for 1 ta...

Rails: Passing Variables from a Class Method to an Instance Method -

I have several models that are a matter of concern. Each model passes in a hash, which means that they handle small differences using anxiety. I pass the hash through a class method like this: add_update_to: group ,: user is the full code of concern: Module Updateable ActiveSupport Expand: Expand Attr_accessor: Stream Module ClassMethods def add_updates_to (* stream) @ streams = streams end end module InstanceMethods def update_streams @ streams.collect {| Stream | Self.public_send (stream)} has been included at the end: Update, as: = & gt; : Updatable after_create: create_update_and_history end personal def create_update_and_history update = self.create_update (: user_id = & gt; User.current.id) self.update_streams.each do | Stream | Stream.histories.create (: update_id => update.id) End ending Most of the code works, but I have to pass a hash from class to an example The problem is happening. At the moment, I am trying to make this effect a virtual characte...

javascript - Dynamically loading html and clearing DOM -

So I'm working with some multipage jazzery mobile documents that I want to be able to navigate, but WebView The transition made and still by the mobile web app is I came to Todd Thomson's subpage widget and originally did not understand how to set up everything (there is no template or demo on the visual liver and its github, there is no Todd if you are there). So my question is, when you navigate to Multilanguage Jquery Mobile Documents from index.html , via AJAX page1 Html it is clear who will survive index.html and load the remaining page1.html after the transition? When you link index.html to page1.html, which is a mutli page document, You must add a link to the rel = "external" attribute. This allows you to add the domain to the multiple pages of a document through the # anchor.

c - using #define #ifdef for conditions -

GCC 4.7.2 c89 Hello, I have the following code that I think the RTP stream will not be modified #define DO_MODIFY_RTP #ifdef DO_NOT_MODIFY_RTP if (modify_rtp_media_stream (channel> IPM) = = FALSE). {Status = false; } #endif When I want to modify the RTP stream, I will set it to #define : #define DO_MODIFY_RTP #ifdef DO_MODIFY_RTP if (modify_rtp_media_stream (channel-> ipm) == incorrect) {status = FALSE; } #endif Eventually it will be controlled by a property in a configuration file. Is it strange to use #define in this way? Many thanks for any suggestions, Generally, Do not want to modify the code, so you'll probably do something like this: #undef MODIFY_RTP #if define (DO_NOT_MODIFY_RTP) #define MODIFY_RTP 0 #else #define MODIFY_RTP 1 #endif if ( MODIFY_RTP) {if (modify_rtp_media_stream (channel> IPM) == incorrect) position = FALSE; } You may type -DDO_NOT_MODIFY_RTP on the compiler command line, or in a configuration header, you ...

SpreadsheetGear - Create a workbookview by code -

How do I create a workbook using the spreadsheet program with code? I do not want to use the workbook view control on the form, I want to create it dynamically, then keep it under a tab control with the code. You create a workbook view object and add it to the tab page control. Spreadsheetsgear Windows.form. See Workbook Workbook 1 = New SpreadsheetGear Forms.WorkbookView (); TabControl1.TabPages [0] .Controls.Add (workbookView1);

iphone - iOS: How do i prevent temporary files Visibility -

I am working on an app that still produces temporary video from the image. But I do not want the user to see the temporary file I created. But when the app is producing a video file, this video lists it by the camera roll. My question is how can I generate a temporary media file which is ' Camera Roll, iTunes and iCloud '? Please help me in advance thanks. Code: [assetWriter Finish with Finnish writingHandler: ^ {NSURL * url = _outMovieURL; Elasette Library * Library = [[Elsace Library Library] init]; [Write LibraryWidth AudioAppetSite Photo Album: URL ClosingBank: ^ (NS URL * Asset URL, NSER * Error) {NSLog (@ "Don!"); }]; }]; This block: [assetWriter finishWritingWithCompletionHandler: The file is to be written in the camera roll so do not use it, instead you have made temporary video instead (or maybe it already has the documentDirectory When you are making this, you just do not want to write that file in the camera, write a temporary vide...

node.js - Temporary File Download -

Is there a service that basically downloads a once file, preferably Can some nodes use from JS? I have done some research on Filippaker, and there is nothing about reproducing the link that you give for the file, it can be a way of doing it with nodjs, But I am using the meteor. At the same time many node things will probably struggle. You can create it with meteors and experiment with & amp; Server JS var download = new meteor. Compilation ("download"); // Download a link .int ({url: "/ mydownload.zip", downloaded: false}) Meteor.Router.add ('/ file /: id', 'gET', function (id) { Download = downloads .findOne (id); if (download) {if (dowload.downloaded) {this.response.send ("You have already downloaded me")} Other {// I think that you redirect the file Or stream an additional layer of the antidote to this.response.redirect (download.url);}}}); You can use / files / {{_ id}} on the client with the file that has...

android - Persistent Toast Message: Toast won't disappear after execution -

I have a toast message that has not disappeared after execution. I'm guessing that there is something in the loop with it, but I'm not sure. Can someone help me to understand why the toast message is not different? @Override Click Public Zero (see V) {int index = 0; {If (email.getText (). ToString (.) Equal to (userArray [i])} {index = i; (i.e. } If passArray [index] .equals (password.gettext (). ToString ()) {toast.makeText (getBaseContext), "success!", Toast .LENGTH_SHORT). Show (); } And {toast} GetBaseContext, "INVALID LOGIN", toast .LENGTH_SHORT). Show (); }} Intention Main Identity = New Intent (Login Activity., Main Activity Category); StartActivityForResult (key component, 0); } } If a toast message is trapped A service is called thread and the work is completed before the toast is set to disappear. Then you get stuck with a toast message on the screen until you kill the app.

visual studio extensions - how to get the selected connection node object of VS Server Explorer window DDEX -

I am adding some options for the connection node to my VS extension in Server Explorer. For the menu options I added, I need to get the connection string of the very selected connection, so I have tried before by adding some code to the LineStatus event and also in the command handler mode. But it seems that every time I want to get an example of DataViewHierarchyAccessor, since then I am missing something, I always get a zero value. Although I do the same thing but works fine in the lower level node. I have used the following code with no luck: IVsDataExplorerNodeSelection Node Selection = (IVsDataExplorerNodeSelection) Package.GetGlobalService (Typef (IVsDataExplorerNodeSelection)); IVsUIHierarchy hierarchy = Marshal.GetTypedObjectForIUnknown (hierarchyPtr, typeof Update: It looks like I have found something I & Nsquo; progress on it , I tried it now: EnvDTE80.DTE2 _applicationObject = GetDTE2 (); UIHierarchy uih = _applicationObject.ToolWindows.GetToolWindow (...

java - Maven says that there is now dependency despite the fact that it exists -

I have a project of two modules and I have to use the class in the second one for the first time. For this, I have added the dependency of the first palm file: & Lt; Version & gt; 1.0-snapshots & lt; / Edition & gt; & Lt; / Dependencies & gt; The following is when I am trying to add the module: & lt; Project xmlns = "http: // maven.apache .org / POM / 4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schema location = "http: / /maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> & Lt; ModelVersion & gt; 4.0.0 & lt; / ModelVersion & gt; & Lt; Parents & gt; & Lt; ArtifactId & gt; DLP & lt; / ArtifactId> & Lt; Group & gt; Com.messagedna.dlp & lt; / Group & gt; & Lt; Version & gt; 1.0 & lt; / Edition & gt; & Lt; / Parent & gt; & Lt; Group & gt; Com.mdnaRabbit.worker & lt; / Group & g...

android gmail opening app attachment URI issue with new Gmail app version -

I have the following intent filters in the manifest. This code is working with Android 4.2.2 to work fine on a Nexus 7. Used until Google had updated its Gmail app 2 days ago. My app is no longer shown in the proposed list of apps that can open this type of attachment. If I uninstall updates, then it works back ... as any idea what can I do to make it work again? & lt; Intent-filter & gt; & Lt; Action Android: name = "android.intent.action.VIEW" /> & Lt; Category android: name = "android.intent.category.DEFAULT" /> & Lt; Data Android: Host = "*" Android: Android: Android: Android: "Android: Android: Android: Pathpapton =". *. Grb "Android: scheme =" content "/> I have looked everywhere for a solution, and unfortunately, this version of Gmail will be a different mime type and plan because the Gmail ur is now in this format: content: //gmail-ls/email@example.com/messages/1162/attachments/...

Access Model from View Helper in Zend Framework 2 -

I'm trying to access my configured model with Custom View Assistant in my application to fill some global input fields . Is there a way to bring the object to an assist model from that view, which I am calling with global layout If this is not possible, then how do I create values Can I cross the elements? Many thanks for your help. Barley Rage There is a module that allows you to view the service manager but it is not a good one P>

java - flextable get clicked column when there is rowspan -

I have a flicktale with the light on the table I click on the table of the index and the kernel index trying to get the index I am here. If there is no line of time in that line then there is no problem, but when there is a row duration in the line then I am getting a lower serial number that should be. I'm getting this: idx: index i am receiving sCnt: span count on that line clIdx: column index that i click on idx = clIdx-sCnt; I am using this code: int row = flexTable.getCellForEvent (event) .getRowIndex (); Int col = flexTable.getCellForEvent (event) .getCellIndex (); Good I could not find the solution but I did something, I do not like NG INN The Focus Panel has a new extended widget written and this column and row are indexed. These are set in the indexed constructor and I access the index through the click event of my widget.

java - How come i get a syntax error code 1 in this simple sqlite query -

I have found a sqlite query that looks like this: string sql_group = " Create a table group (id VARCHAR (25), name VARCHAR (25), account_id VARCHAR (25)); " And when I do: Db.execSQL (sql_group); This gives a serious error, I have a syntax error code 1 while compiling. I do not know what this is. Because GROUP , which is the name of your table, a reserved keyword is. You still use it but you have to remove it from brackets , string sql_group = "create table [group] (id varchar (25), ... ... But I suggest you use such names to avoid problems in the future. Should be avoided.

c# - Data Access Design Pattern -

I am currently preparing a Windows 8 Store app for which I need to call many web service calls. The call returns a JSON string which I am deserilizing in objects. I'm using the MIVVM design pattern with Caliberan. WinRT for Micro Viral Initially, to get data from each of my visual models for web service calls, I created a class, datastore, which declared itself as a stable example of the properties of that class Which were related to all my models. When a web service call is required, I called a steady class method in "APIIDA", which read in a dictionary of parameters, serialized those parameters in JSON, created an API call and returned the JSON result to the DataStore class Gave. At which point JSON was deserialized and used to update datastore properties. This happened in the form of duplicated code and a very messed datastore class. My question is, what would be a good design pattern to use, where should the model be used to return JSN from website calls? ...

Get Android's CPU tempareture on NativeActivity -

How do I obtain CPU templates on native activity? I think, I should use jclass and FindClass methods or something similar. I do not know how to do this. You can use TYPE_AMBIENT_TEMPERATURE for battery or CPU temperature. TYPE_TEMPERATURE exclusions are continuous. The public class extends the TempSensorActivity Activity, implement sensor event listener {Private Final Sensor Manager, mSensorManager; Private Final Sensor Amtax Sensor; Public TempSensorActivity () {mSensorManager = (Sensor Manager) getSystemService (SENSOR_SERVICE); MTempSensor = mSensorManager.getDefaultSensor (sensor.TYPE_AMBIENT_TEMPERATURE); } Secure zero () at reserve {super.onResume (); MSensorManager.registerListener (this, mTempSensor, SensorManager.SENSOR_DELAY_NORMAL); } Protected void (cause) {super.onPause (); MSensorManager.unregisterListener (this); } Changed Accuracy on Public Zero (Sensor Sensor, Integer Accuracy) {} Sensor Converted to Public Zero (Sensor Event Event) {} Click to Refer to

linux - Memcached: Where to put? -

For the Drupal stack, I have 3 servers: Varnish Web server Database server .. and Assume that I have only 3 server boundaries. I no longer have servers. . Now I have to set up memcatch , but I'm not sure where to set it up. So made for drupal stack : Where to put it? (Instead of talking about another separate box.) Honestly, as I found the Drupal Memkacked Module , even though I did not have the Memory is meant for the application server, where the scripts are sitting on, so I have put it on the web / application server but it seems that the result is worse earlier. So how? On Database Server? Or, at all? Your varnish server is already using its own RAM to store cached pages is. Its weight should probably be kept at a minimum, so that it can quickly prepare the responses to HTTP requests. Caching with Memcache will not reduce your load. Your Drupal Server will already respond to requests. D Drupal usually consume a lot of RAM. And the main reaso...

vbscript - VB Script copy csv file data to excel sheet. please help me any other way -

sub addcsvdatatoxcel () 'file names to ask the user filename = "e: \ Surendra \ Excel_Testing \ NewTemplate \ C_0_1 \ AccelVsTime.csv "Check for an entry" if the file name = "" ends "'Get the next available file handle number FileNum = FreeFile () Open the open text file for the input file name set 'counter 1 counter #FileNum as in = 1' loop until the file has not yet expired (file News) & lt; = a OFF (File New) Display the display of a row number on the status bar 'Store a line from the store store for variable line input #Filename, Result store OExcelReadWorkSheet2 splitValues ​​= Split (ResultStr, ",") Change the variable data in the active cell counter (counter, 1) = (split value (0), crow (34), ""). Change the cell (counter, 2) = (split value (1), crow (34) ""). (counter, 3) = Change (Split value (2), Crow (34), "") Ksel (counter, 4) = Change (Split Vely (3), Crow (34), "" ...

php - check for string in txt file on remote server -

अरे दोस्तों को एक दूरस्थ सर्वर पर विभिन्न subfolders में शब्द त्रुटि के लिए खोज करने की कोशिश कर रहा हूँ सबफ़ोल्डर्स दर्ज करने के लिए मैं पथ में एक चर का उपयोग करता हूँ। मेरा कोड हमेशा यह काम नहीं कर रहा है नहीं मिला , लेकिन कुछ .txt फ़ाइलों में डाला गया परीक्षण मैं शब्द त्रुटि तो मेरे कोड में क्या गलत है? $ file_to_check = 'file: //bgsttc11/backup/'.stst [$ j] [1]।' / Log.txt '; प्रतिधारा $ path_to_check। '& Lt; br & gt;'; अगर (strstr ($ path_to_check, 'ERROR')) {गूंजना 'मिला & lt; br & gt;'; } Else {इको 'नहीं मिला & lt; br & gt;'; } आप केस असंवेदनशील के लिए इस्तेमाल कर सकते हैं और यदि स्ट्रिंग मौजूद है, और आप जांच कर रहे हैं फ़ाइल का नाम और सामग्री नहीं: $ file_to_check = '\\\\ bgsttc11 \\ बैकअप \\'। $ Stask [$ j] [1]। '\\ log.txt' ; $ Position = stripos (implode ('', फ़ाइल ($ path_to_check)), 'त्रुटि'); अगर ($ स्थिति! == गलत) {प्रतिध्वनि 'स्थिति में मिला...

javascript - what is the usage of $("#element").on("click", function(event){ }); in jquery? -

इस सवाल का पहले से ही एक उत्तर है: 7 जवाब मैं Jquery और मैं $ ("# element") के बीच के अंतर को जानना चाहूंगा। पर ("क्लिक करें", फ़ंक्शन (ईवेंट) {}); और $ ("# तत्व")। लाइव ("क्लिक करें", फ़ंक्शन (ईवेंट) {}); फ़ंक्शन। एक के लिए अच्छी तरह से $ और अधिक विवरण के लिए आप इस उत्तर की जांच कर सकते हैं:

asp.net mvc - Html.ActionLink() with HttpPost decorated action -

मैं दूसरी कार्रवाई index नीचे कैसे कॉल करूँ? सार्वजनिक ActionResult Index () {} [HttpPost] सार्वजनिक ActionResult Index (FormCollection संग्रह, स्ट्रिंग अगली बटन) {} एक ActionLink से? मैं सफलतापूर्वक बिना नीचे कोड का प्रयास कर रहा हूं: @ html.ActionLink ("अब खरीदें", "सूचकांक", "स्टोर", नया {संस्करण = "एसटीडी", अगला बटन = ""} धन्यवाद। एक्शन लिंक को एक एंकर लिंक उत्पन्न करने के साथ डिफ़ॉल्ट रूप से किया जाता है, इस प्रकार जब क्लिक किया जाता है तो समापन बिंदु पर GET अनुरोध किया जाएगा। आप jquery का उपयोग करने के लिए एक एएक्सएक्स का प्रयोग करके एंड्रॉइड के एक्शन एक्सपेंडर पर पोस्ट करें। $। Ajax ({url: 'http://endpoint.com', टाइप करें: 'पोस्ट', डेटा: $ ('# form' )। सीरियलइज़ () // कुछ पोस्ट डेटा जोड़ें हालांकि आप चाहते हैं।}); या आप एक फॉर्म का उपयोग करके अंतिम बिंदु पोस्ट कर सकते हैं। आपको अपने समापन बिंदु को [मान्यडेटीफ़ॉर्गरी टोकन] के साथ सजाने चाहिए, यदि कोई फॉर्म का उपयोग करना है...

html5 - Calling a local datasource using KnockoutJs -

I want to write a small application that keeps customers information, for example, contact details and orders. I see using knockout and I need an app to disconnect from the internet. My application I want to add a search box is Bootstrap TypeHead) at a global level which will allow me to search for a customer and navigate to a view. I do not know that the database is using the database and is using KO vm to read data from the Dob. I have started looking at Websearchy to store customer information and commands, although I can only use WebKit which is not ideal. Does anyone have any experience using the KO with a local dataset? Can anybody recommend good resources? "post-text" itemprop = "text"> I faced a single problem, around a small generic abstract layer modeling repository pattern and that pattern for both WebDb and IndexedDB General Implementation Writing These days, unfortunately, Apple has to support WebDB because of its ignorance.

php - MongoDB Query to find out all the array elements of a collection -

I have a very large MongoDB document that keeps all kinds of data, I need to identify the fields which There are type arrays in the collection, so I can extract them from the fields displayed in the grid which I will populate. My method now involves retrieving all field names taken from the posted response and such a query runs for each field Db.Product .find ({$ where: "Array.isArray (this.Orders)"}). Count () If any area has been retrieved, The array is considered. I do not think I need to run n + 2 questions (my collection has a number of different areas) and I would not like to hardcode the fields in the model. It's MongoDB's Is there a better way to do this? I made some minor amendments to the code given above: mr = db.runcommomm ({"mapreduce": "product", "map R ": function {} ({var (key, 1);} else {emit (key, 0);}}}, {if (Array.isArray (this [key]) "Reduce": function key, content {back com...

Can we convert graph into set in ruby -

How to change the following article in 'set' because I have a graph I need to check that graph is this graph Has a subset of is required 'RGL / Implication' DG = RGL :: Guided Gadget Graph [1,2,3,4,5,6,3,2,4] thanks. This to_set method will do this for you. Expected 'rgl / adjacency' dg = RGL :: Guided disablement graph [1,2,3,4,5,6,3,2,4] dg_subgraph = RGL :: Directedgegeographic graph [1, 2] Dg_subgraph.to_set.subset? Dg.to_set # = & gt; True Why? According to To represent the adjacent list, the square is of a top, by default, a set Unless you configure it otherwise.

Error in reading ' (apostrophe) from text file into sql server -

I am bulking from a text file on the sql server, but facing the error in reading the text file This error is due to the presence of 'in the text file', as it is known that 'the string is used to indicate the beginning and end, please tell me how the eyewater arrives. The text file is for inserting data from SQL data from bulk insert #tmpfile to c: \ data.txt (firstrow = 2, fieldterminator = ':!' , Rowtermintor = '\ n') A line in the text file where 'is present 32562:!: Sequoandan Muriki, analyst,' Development activities Belongs to ------- & gt; I have no right to edit the text file by placing another Astro (') to avoid here, please tell me what to do 'is a surviving character, if you do a search and change it again with' (this two single quotes) this is your problem Will solve

Uninstall from command-line using installshield -

Is there any way to be able to uninstall an installer rather than upgrade? I currently have a Setup.exe and an MSI file but every time I try to uninstall by using pre-registered ISS. If my installation is older than the current version, this is the first time the upgrade And if I run the same file again, it is uninstalled, Now I am thinking that if there is no way where I can force it in uninstall --- it That's what i Currently done ... \ setup.exe "/ x / s /f1c:\Remove.iss Why not use cache on your machine, instead of using setup.exe? Check the uninstall key for details (such as path) and If you can still mix in your / s /f1C:\Remove.iss the pages of the removal are identical.

insert - SQL - Guaranteed execution of all statements -

I want to run a series of SQL INSERT statements. The problem is that I want an all-or-something approach, or if they execute all of them or one of them is not executed, then there is no change in the database. I can imagine that the only solution is using conditional loop, but does it mean unnecessary code (determining changes, leaving tables etc.) is there a simple solution? I have searched extensively for a solution, but have not received any similar questions, so if asked before, apologize You need to use a transaction , you can find an MSDN example.

jenkins - Findbugs java result: 137 static analysis plugin -

We are running a findbug job on Jenkins after each comment, which has been published by the Static Analysis Plugin. It usually works perfectly as expected, but from time to time (makes about 100 each time) findbugs exits with exit code 137. When this happens, it generates a completely empty findbugs.xml file The reason for the empty XML file static analysis plugin to think that this build is not really terrible (no bugs) and This uses a new reference form, which in turn makes it unsuccessful / unstable later. I can not find anything useful really what this exhaust code should mean, or how to stop it. I'm exploring a way to either prevent this evacuation code 137 or to take a stable analysis plugin as a result of this failure (instead of creating a new reference) I would also like to Know what this code really is. Job console output with exit code 137 (Job: # 1 577, no bug report) --- Cutting - more application bug patterns - [findbugs] edu.umd.cs.findbugs.detect.Mult...

shell extensions - Icon Overlay Handler for multiple icons -

For example: How to implement the icon overlay handler / P> foo.bar - d: \ myicon1.ico bar.bar - d: \ myicon2.ico I tried IShellIconOverlayIdentifier but it A handler Instead of an icon overlay icon Use handler Look good

entity framework - PowerTools Beta 3 fails -

I was trying to generate "view" to increase the performance of my application. The application is linked to RIA services from serial lite 4 servers. Server application started with EF 4.1+ RIA Services. I installed "EF Power Tools Beta 3 v0.7.0.0" and could generate my thoughts without any problems. But I soon realized that EF 4.1. Precompiled ideas were not able to profit EF & gt; = 4.2 was necessary through Nuget I saw an update for RIA services (RISSVICE. AntiquiFramework.4.0.0), which used EF5. I used to install and do everything, but when I try to create ideas, I get an exception: The system reflection. Target invocation exception: An exception has been thrown to the goal of an invitation. --- & gt; System.Reflection.ReflectionTypeLoadException: Unable to load one or more requested types Recover the LoaderExceptions property for more information. I have tried to restore PowerTools. No luck, I downloaded the source code for the power tools and ...

data binding - WPF DataGrid to BindingList not working, never shows results -

I am trying to bind data to a datagrid via a property and then change that property later (Sorting) results in datagrid I initially tied the DataGrid: Binding List & lt; Bookings & gt; TourBookings; Private Ascend Free Pageframe_loaded_1 (Object Sender, Routing Avenger ARG E) {TourBuying = New Binding List & lt; Bookings & gt; (Waiting Datamanager Bookings Reef Gatebooking Headers (Pages, Current Page.) Tour Bookings); DgBookings.DataContext = TourBuying;} There is nothing in the DataGrid at this point, Either way I have a method: Private async zero DataGrid_Sorting_1 (object sender, DataGridSortingEventArgs e) {tourbooking = new binding list & lt; booking & gt; ((Datamizer Bookings Reef GateBooking Headers (S, ACC, Pages, current page)). Bookings;} .. There is still no result in my datagrid ... Where are my results? DataGrid x: name = "dgBookings" DataContext = "{binding path = tourbooking}" style = "{StaticResou...

Programatically Add Control to ASP.NET C# Page on Button Click -

I want to add fixtures to a special game week on my ASP.NET c # page. When a user clicks on the add button, then he should make two drop downs so he can choose home and away team. I want to be able to allow as many users as I want to add, so I want a dynamic way of adding control to the page. Once all the fixtures have been added, I want them to save all of them in the database. Scrolling trough platforms have found the following method to get me control for writing programs: c # Protected Zero AddTeamButton_Click (object Sender, EventArgs e) {DropDownList homeTeamName = new DropDownList (); HomeTeamName.Items.Add ("Arsenal"); HomeTeamName.Items.Add ("Aston Villa"); HomeTeamName.ID = "Homemade"; PlaceHolder1.Controls.Add (homeTeamName); Remove dropdown Remote namespace = new dropdown list (); AwayTeamName.Items.Add ("Arsenal"); AwayTeamName.Items.Add ("Aston Villa"); AwayTeamName.ID = "remote"; PlaceHolder1.Contro...

regex - How do I stop a Regular Expression when I reach a certain character in PHP? -

I have a string, / controller / method / parameter1 / parameter2? Parameter1 = parameter2 . This is just REQUEST_URI , I am using for my website. I would like to split into separate array elements using PHP this string, and the following code works fine for this action: Preeg_split ( '[/]', $ _SERVER ['REQUEST_URI'], NULL, PREG_SPLIT_NO_EMPTY) . This works almost completely, provides me excellent ARA output, as long as I do not add the variable Get these variables in the last array element, along with these. My question is, is there a way to stop processing as well as reaching a question mark (?)? I want to cut it with a question mark, and show items only before the question mark. This (expected) would mean that: array ([0] => controller [1] => method [2] = & gt; parameter 1 [3] = & Gt; Parameter2? Parameter1 = parameter2) It will be: array ([0] = & gt; Controller [1 ] = & Gt; Method [2] = & gt; Parameter 1 [3] = & g...

android - when don't keep activities selected on Setting , progress dialog is not dismissing -

जब "क्रियाकलाप न रखें" का चयन सेटिंग डेवलपर विकल्प पर होता है प्रगति संवाद खारिज नहीं होता है असल में, मैं प्रोजेक्ट्स बार को प्रदर्शित कर रहा हूं, एप्लिकेशन को इनिशियलाइज़ करने के लिए, जब मैं गतिविधि ए से गतिविधि बी जा रहा हूं और फिर गतिविधि ए में आया हूं, तो प्रगति बार पूरा होने के बाद खारिज नहीं होता है। नीचे मेरा कोड है, पहला गतिविधि पैकेज com.example.donotkeepactivitiesalive; आयात एंड्रॉइड। एप। आयात करें android.app.Dialog; आयात करें android.app.ProgressDialog; Import android.content.Intent; Android.os.AsyncTask आयात करें; Importroid.os.Bundle; Import android.view.Menu; आयात करें android.view.View; आयात करें android.view.View.OnClickListener; आयात करें android.widget.Button; सार्वजनिक कक्षा मुख्य गतिविधि गतिविधि को बढ़ाता है {सार्वजनिक स्थिर अंतिम अंत MESSAGE_PROGRESS_BAR_INITIALIZING = 1; निजी डायलॉग m_cObjDialog; @Create पर सार्वजनिक शून्य को ओवरराइड करें (बंडल सहेजे गए इन्स्टैंसस्टेट) {सुपर.नक्रेट (सहेजे गए इन्स्टेंसस्टेट); setContentView (R.layout.activity_m...

javascript - How to implement Facebook conversion tracking onclick or when there's no separate 'Thank you' page -

Trying to implement Facebook conversion tracking in the Facebook tab, you can see this page here that once the form is submitted After doing the problem is not a separate page. Can I make a part of the javascript run, but click the submit button, I think it has been injected into the head of the HTML doctor. I found this answer to run JavaScript from a link or click - can I call on a tracking / conversion code from a different JS Doctor? Any help would be greatly appreciated - thanks! "I have to agree to the comments given above, that you can not call a file, but you can load a JS file like this, I'm sure if it answers your question , But it can help ... Oh and I have used a link instead of a button in my example ... & lt; a href = 'linkhref.html' Id = 'mylink' & gt; click me & lt; / a & gt; script type = "text / javascript" & gt; var myLink = document.getElementById ('mylink'); myLink.o Nclick = function () {var...

entity framework 5 - Map a field to an enum in EntityFramework 5 Code First -

In this way, I have a class, as follows: public class Message {public anonym message type {text = 0, audio = 1, image = 2} public at UID {received; Set; } Public message type type {get; Set; } Public string text {get; Set; }} As you can see, the type field is an enum, to match the data of this class, my mapping is defined as: Public class MessagesMap: EntityTypeConfiguration & lt; Message & gt; {Public Message Map () {// Primary key is this. Husky (t = & gt; TUID); // Properties This Property (T = & gt; T. Test). Haemax Lang (1000); // Table & amp; This column mapping. Toubles ("wc_messages"); this. Property (T = & gt; T.U.D.). Column name ("UID"); this. Property (T = & gt; T. type) .HasColumnName ("Type"); this. Property (T = & gt; T. text). Column name ("text"); }} But when I run the code, I get the following error: There is no declared property of type 'property' type 'message'...

Project Euler #82 (Python) -

सबसे पहले यह समस्या है:। यह मेरा कोड है: # https://projecteuler.net/problem=82 मैट्रिस = ओपन ('मैट्रिक्स 3 डैस्ट', 'आर')। पढ़ें ()। विभाजन (' N ') एम = [] मैट्रिस में एल के लिए: if el ==' ': जारी रखें tmp = el.split (', ') m.append (tmp) मैट्रिक्स = [[i श्रेणी के लिए (80)] के लिए जम्मू में रेंज (80)] एक्स, वाई = 0,0 जबकि (ट्रू): मैट्रिक्स [x] [y] = int (m [x] [y]) y + = 1 यदि y == 80: y = 0 x + = 1 यदि x == 80: तोड़ें tmp = [0] * 80 x, y = 0,78 जबकि (ट्रू): यदि x == 0: tmp [x] = min (मैट्रिक्स [x] [y + 1] , मैट्रिक्स [x + 1] [y] + मैट्रिक्स [x + 1] [y + 1]) यदि x == 79: टीएमपी [x] = मिनट (मैट्रिक्स [x] [y + 1], मैट्रिक्स [x- 1] [या] + मैट्रिक्स [x-1] [y + 1]) अन्य: टीएमपी [x] = मिनट (मैट्रिक्स [x] [y + 1], मैट्रिक्स [x-1] [y] + मैट्रिक्स [x -1] [y + 1], मैट्रिक्स [x + 1] [y] + मैट्रिक्स [x + 1] [y + 1]) x + = 1 यदि x == 80: श्रेणी के लिए ई (80): मैट्रिक्स [ ई] [या] + = टीएमपी [ई] टीएमपी = [0] * 80 x = 0 y + = - 1 अगर वाई एंड एलटी; 0: ब्रेक...

jquery - Avoid ajax redirection -

Thank you for taking the time to help me. Though I'm sure we say that I have two ASP (classic pages). Target 1.asp which redirects to Target 2.asp with response.redirect (url) Now, I have to use target 1 async methods and you probably already know that I'm using AJAX to do this The problem occurs When I $ Ajax ('method': 'get', [...]) or just $ Fill a bid with the response content to use ('target1.asp') and 'full' callback, it redirects the entire page instead of filling the target 2.asp to the div. The reason is quite simple: the div is literally full of content of target1.asp. The browser still has to redirect and since an avim is not exactly like any iframe, the whole page is redirected. I'm sure you can not redirect directly from Javascript (?). Is there a way to solve this problem without using iframes? This is exactly what I am trying to do: Request target1.asp with the target method using AJAX, or someth...

spectral residual saliency detection in C++ with CImg -

I am trying to apply the spectral residual approach to the salt search described in this letter: There is a reference implementation in Matlab Code, which is derived from their website: Read image from image in clear clique %% file = im2double (rgb2gray (imread ('yourImage.jpg '))); InImg = imresize (inImg, 64 / size (inImg, 2)); %% spectral residual MYFFT = fft2 (inImg); MyLogAmplitude = Log (myFFT)); MyPhase = angle (myFFT); MySpectralResidual = myLogAmplitude - imfilter (myLogAmplitude, fspecial ('average', 3), 'replica'); SaliencyMap = abs (ifft2 (exp (mySpectralResidual + i * myPhase))). ^ 2; After %% effect saliencyMap = mat2gray (imfilter (selcharapmap, fspecial ('gaussi', [10, 10], 2.5))); Imshow (saliencyMap); I tried to translate it to C ++ with CIMG. Where I am failing here: myPhase = angle (myFFT); and here saliencyMap = abs (ifft2 (exp (mySpectralResidual + i * myPhase)). ^ 2; This is my code: #include & lt; CI...